Marfusios / websocket-client

🔧 .NET/C# websocket client library
MIT License
692 stars 127 forks source link

Same request with websocket python library works but not working with websocket-client #123

Open zenconix opened 1 year ago

zenconix commented 1 year ago

Hi there, I am trying to get data from broker. I tried with python's "websocket" library and it works, here is screen capture of python's implementation. image

But when I try to use same request with this library, I am just receiving ping-pong data, not receiving actual data as below image

I tried to check in Fiddler, it shows Ping-Pong messages but not receiving actual data from server. image

Marfusios commented 1 year ago

Hey @zenconix ,

are the sent messages identical in Fiddler?

Did you configure the same headers as it is in Python?

using var communicator = new WebsocketClient(url, () =>
{
    var client = new ClientWebSocket();
    client.Options.SetRequestHeader("Origin", "http://stream.stocknote.com:443");
    client.Options.SetRequestHeader("Sec-WebSocket-Key", "XqTD...");
    return client;
});
xylo987 commented 1 year ago

微软的System.Net.WebSocket是有bug的库。