Using WebSocket on Windows 7

后端 未结 3 1932
灰色年华
灰色年华 2020-12-13 10:04

I just installed visual studio 2012 RC and tried to run a service with netHttpBinding enabling WebSocket and get the following error

This platform does not support s

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-13 10:28

    I ran into the same problem and solved it by using Fleck. Trivially simple to implement:

    One. NuGet add Fleck reference

    Two. Create your webserver socket

    // Create Websocket server
    websocketServer = new Fleck.WebSocketServer("ws://localhost:82");
    websocketServer.Start(socket =>
    {
        socket.OnOpen = () => Console.WriteLine("Open!");
        socket.OnClose = () => Console.WriteLine("Close!");
        socket.OnMessage = message => socket.Send(message);
    });
    

    I now have a a ASP.NET Self Host web API on one port and the websockets connection running along side it.

提交回复
热议问题