Skip to content

Files

Latest commit

Mar 5, 2024
40aca03 · Mar 5, 2024

History

History

web-sockets

Web Sockets (6)

Warning: These samples are low level websocket code. For production, use SignalR. Yes I will work on SignalR samples soon.

  • Echo Server

    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.

  • Echo Server 2

    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.

  • Echo Server 3

    We improve upon the previous sample by enabling broadcast. What you see here is a very crude chat functionality.

  • Echo Server 4

    We improve upon the previous sample by handling closing event initiated by the web client.

  • Echo Server 5

    Use Mvc Controller to handle websocket request

  • Chat Server

    Implement a rudimentary single channel chat server.

dotnet8