AlgoViz

WebSockets

medium 30 min

WebSocket starts as an HTTP request and then turns the same TCP connection into a two-way channel for small framed messages.

Where it shows up

The same pattern appears across everyday software.

  • Discord gateway

    Apps receive events over a WebSocket. The server states the heartbeat interval in its first message, events carry a sequence number, and a dropped client resumes with the last one. Apps may send 120 events per connection every 60 seconds.

  • Slack Socket Mode

    An app asks for a WebSocket URL at run time and gets events there instead of at a public HTTP address. Slack describes it for developers behind a company firewall.

  • Coinbase Exchange feed

    Market data over WebSocket. A client must subscribe within 5 seconds or is disconnected, and messages carry growing sequence numbers for each product, so gaps can be seen.

  • Figma

    Its engineering blog describes pages that talk to the servers over WebSockets. A client downloads the file first, and after that the changes travel both ways on the connection.

  • Browser games

    Moves go up and the state of the world comes down many times a second. Over TCP a lost packet delays the newer ones, so the fastest games look at datagrams.

  • Trading screens

    Prices arrive as small, often binary frames, and orders go up on the same connection. The newest price replaces the older one when a client is slow.