Protocols

WebSocket

WebSocket provides a persistent full-duplex message channel between two peers.

ClientServerUpgrade: websocket101 Switchingmessagemessage
WebSocket provides a persistent full-duplex message channel between two peers. Values shown in the worked visual are illustrative unless the labels state otherwise.

How it works

After an HTTP upgrade, either side can send frames without opening a new request. Applications must define message semantics and reconnection behavior.

A concrete example

Illustrative: one connection carries 200 token events and 4 control messages.

Do not confuse it with Server-sent events

WebSocket is bidirectional; SSE streams only from server to client.

Study the full lesson