WebSockets – C#

Recently I have done some research regarding WebSockets in C# and found two open source libraries – WebSocket4Net and SuperWebSocket.
I found they very powerful but I missed any good example of their work as a couple so I created demo which shows them in action.

Maybe someone will find it useful too:)

I’m using two open source libraries:

My demo placed on GitHub: WebSocketsDemo

Included sources contain two project with selfdescriptive names:

websocketsdemo_screenshot

This post is also available in: polish

  • Someone

    Hi Maga,
    This is awesome. Big thx to you!

    1. download
    2. load .sln
    3. build
    4. go into debug dir and start Server: WebSocketsServerDemo.exe
    5. go into debug dir and start Client: WebSocketsClientDemo.exe

    6. start chatting 😀

  • ganesh

    How to download that project there is no option for download

  • Iwona

    When you go to the Github page with my project: https://github.com/magoswiat/WebSocketsDemo
    On the right column in the very bottom there is „Download ZIP” button.
    Here is the direct url to download: https://github.com/magoswiat/WebSocketsDemo/archive/master.zip

  • ganesh

    i want this application in C# web site how i used it

  • Searched long and hard today for all kinds of socket connections and examples. Finally found yours with the info I needed. Thank you.

    Jim.

  • Arthur

    Thank you, it easy to use.

  • Archana

    Thank you so much for putting an example out there. It was hard to understand and code everything from scratch using SuperWebSocket and WebSocket4Net. This simplified my life.

  • Have you tried SignalR? It is a library for real-time web applications which uses WebSockets underneath if they are available. It’s dead simple to use.
    https://www.asp.net/signalr