Is it possible to refer external libraries (CDN) in function node?
Not certain how you would achieve that but there is the NPM node that downloads package from NPM and uses
require syntax in a function node.
However, that said, there are many pre-made nodes. What in particular do you want to do that makes you think you need to get code/lib from a CDN / external source?
As per my business logic, i need to connect to a wss protocol and should subscribe to topics (not mqtt, only websockets). I am able to connect to the websocket url but dont know how to subscribe to the topics.
That sounds like some custom application logic over web socket. Topics are not really "a thing" inherent to web sockets. I don't see any reason you couldn't use the built in web socket node. Do you have protocol details & API details for this connection?