Skip to content

officedev27/websocket-sharp-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

websocket-sharp-example

This is a good starting setup to use the websocket-sharp library (https://sta.github.io/websocket-sharp/) in an application which is primarily built for websocket connections. This type of functionality was not immediately obvious from looking at their documentation, so I'm putting this here to save other people's time. Built in C# .NET 5.0. Uses a WSServer class to manage the WebSocketServer library with a built-in message dispatcher using ConcurrentQueue. Uses a WSClient middleware class with its own per client ConcurrentQueue message buffer for sending messages. Both WSServer and WSClient are in Program.cs. Client.html is used to connect to the running application once started.

A simple fast counter is used in Form1 to generate outgoing messages to the clients. Messages are generated quickly to demonstrate no bottlenecks. You will see messages when connected using client.html. It's recommended to only connect for a few seconds at a time since it could bog down the browser.

About

This is a good starting setup to use the websocket-sharp library in an application which is primarily built for websocket connections.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors