sta / websocket-sharp

A C# implementation of the WebSocket protocol client and server
http://sta.github.io/websocket-sharp
MIT License
5.74k stars 1.66k forks source link

Not a WebSocket handshake response | Why not? #733

Closed OssieFromDK closed 1 year ago

OssieFromDK commented 1 year ago

Hi, I have the following code to connect to a websocket, which I know exists.

internal Socket()
{
    using (var wss = new WebSocket("wss://<whatever>.com/socket.io/?EIO=4&transport=polling"))
    {
        wss.EnableRedirection = true;

        wss.OnMessage += (sender, e) =>
          Console.WriteLine("New message from controller: " + e.Data);
        wss.Connect();

        Console.ReadKey(true);
    }
}

The response is the following from the socket if I try to follow the uri I'm using the new WebSocket(blabla): 0{"sid":"HzvIKK7jW8lETZjzADTU","upgrades":["websocket"],"pingTimeout":20000,"pingInterval":25000}

Yet I keep getting Not a WebSocket handshake response.??

How is it not a websocket handshake response?, I can connect just fine using Javascript with io.connect("whatever.com"). Why won't it work in CS?

Thanks