websocket-client icon indicating copy to clipboard operation
websocket-client copied to clipboard

Cannot connect to websocket over HTTPS

Open TMGMike opened this issue 2 years ago • 2 comments

I spent a few days preparing my WPF app for websocket connections, and I now can't go any further because I discovered the library can't connect to anything other than ws:// or wss:// (would've been nice for this to be documented somewhere 😞 )

What can I do about this? Surely there's some way around this?

This was the most recommended package for client connections, and looking at others on NuGet, they haven't been updated in years...

TMGMike avatar Jun 22 '22 18:06 TMGMike

This is kinda basic and got nothing to do with the library. https is for http traffic, not websocket traffic. when you want to use secure websockets, use wss://

BasieP avatar Jun 28 '22 10:06 BasieP

This is kinda basic and got nothing to do with the library. https is for http traffic, not websocket traffic. when you want to use secure websockets, use wss://

I am aware this is basic, and I'm aware of the "typical" uses of the protocols... However, the socket I was connecting into only documents https:// connections: https://dev.streamlabs.com/docs/socket-api When connecting into this socket API using SocketIO in NodeJS, the https protocol is supported (as the example shows).

I was asking whether this library has support similar to that. Your suggestion of simply using wss:// is not helpful, as you said yourself they are nothing alike, so just replacing the protocol with wss:// is not going to work.

FWIW, I eventually managed to find someone that had managed to find the underlying websocket which wasn't documented, which meant decoding the data and parsing event types manually: new Uri($"wss://sockets.streamlabs.com/socket.io/?token={token}&transport=websocket"

TMGMike avatar Sep 29 '22 12:09 TMGMike