6

I just started looking at examples for connecting to a websocket in C# and realised they all use .NET 4.5. I'm using Visual Studio 2010 in Windows 7 - are there any examples or libraries available for this?

parsley72
  • 8,449
  • 8
  • 65
  • 98

3 Answers3

5

I ended up using websocket-sharp - very easy to build and use.

parsley72
  • 8,449
  • 8
  • 65
  • 98
  • The problem is that they don't have any releases. You're stuck with using master branch and recompiling it yourself. – krl Apr 08 '16 at 09:37
2
Siuli31
  • 31
  • 2
2

You cannot host web sockets on IIS 7.5 but you can host your own web server using Fleck

You can download it from github or type fleck in nuget.

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);
});
Dennis Nerush
  • 5,473
  • 5
  • 25
  • 33