WebSockets: staying connected

From one HTTP upgrade to a two-way live connection, how chat and realtime apps stay connected.

Normal HTTP is ask-and-answer: the client asks, the server replies, the connection is done. WebSockets start as a regular HTTP request that asks to 'upgrade', and when the server agrees, the connection stays open in both directions.

From then on, either side can send a message at any moment, no polling, no re-connecting. That's what powers chat, multiplayer games, live dashboards and collaborative editors, where waiting to be asked would be too slow.

Remember this

  • One HTTP upgrade, then a persistent two-way channel
  • Either side can push messages at any time
  • The fit: chat, games, live data, anywhere polling wastes time

Got a different question? SeaThru generates a fresh video for any topic where systems talk or data structures move.

Ask your own question →

Keep learning