Getting disconnected as soon as I connect to PubSub C#

That code is an example of bad code that will result in an object disposed. You don’t want to use that.

Read the documentation on WebSocket4Net (or WebSocketSharp if you’re still using that.)

WebSocket4Net docs: https://websocket4net.codeplex.com/documentation