C#中的基本WebSocketSharp客户端连接

时间:2017-08-24 11:03:32

标签: c# websocket websocket-sharp

如何让它工作:

using (var ws = new WebSocket("wss://echo.websocket.org"))
{
    ws.OnMessage += (sender, e) =>
      Console.WriteLine("RESPONSE: " + e.Data);

    ws.Connect();
    ws.Send("TEST SEND");
    Console.ReadKey(true);
}

错误是:

Authentication failed because the remote party has closed the transport stream.

1 个答案:

答案 0 :(得分:0)

如果我使用,似乎可以工作:

using (var ws = new WebSocket("ws://echo.websocket.org"))