Warning: These samples are low level websocket code. For production, use SignalR. Yes I will work on SignalR samples soon.
-
This is the simplest web socket code you can write. It simply returns what you sent. It does not handle the closing of the connection. It does not handle data that is larger than buffer. It only handles text payload.
-
We improve upon the previous sample by adding console logging (requiring
Microsoft.Extensions.Logging.Console
package) and handling data larger than the buffer. I set the buffer to be very small (4 bytes) so you can see how it works. -
We improve upon the previous sample by enabling broadcast. What you see here is a very crude chat functionality.
-
We improve upon the previous sample by handling closing event initiated by the web client.
-
Use Mvc Controller to handle websocket request
-
Implement a rudimentary single channel chat server.
dotnet8