WebSocket RFC 6455: the protocol for real-time web

WebSocket RFC 6455 (December 2011): IETF standard protocol for browser-server full-duplex communication over TCP. HTTP handshake, binary framing, universal browser support since 2012. Foundation of web chat, trading, gaming.

Open SourceWeb WebSocketRFC 6455IETFReal-timeHTTPOpen SourceWeb

The limit of polling

Before WebSocket, “real-time” communication between browser and server is achieved with workarounds:

  • Short polling — client repeats HTTP requests every N seconds
  • Long polling — HTTP request held open until event
  • Comet — HTTP streaming techniques
  • Server-Sent Events (2006-2009) — unidirectional server→client

None is efficient for bidirectional low-latency communication (chat, trading, gaming, live dashboard).

The release

RFC 6455 is published by the IETF in December 2011. Main authors: Ian Fette (Google), Alexey Melnikov. The protocol had been introduced in draft in 2008 by Ian Hickson (HTML5 spec) and Michael Carter.

The final draft is worked on by a working group including browser vendors, Apache Foundation, other implementers.

How it works

  1. HTTP Upgrade handshake — client sends GET with Upgrade: websocket header
  2. Server responds 101 Switching Protocols
  3. Persistent TCP connection — after handshake, binary WebSocket frames
  4. Framing — text/binary/close/ping/pong frames with client→server masking
  5. URI schemews:// (plaintext) or wss:// (TLS)
const ws = new WebSocket('wss://api.example.com/stream');
ws.onmessage = (e) => console.log(e.data);
ws.send(JSON.stringify({ action: 'subscribe' }));

Browser adoption

  • Chrome 14 (September 2011) — final support
  • Firefox 11 (March 2012)
  • IE 10 (September 2012)
  • Safari 6 (July 2012)
  • Opera 12.1 (November 2012)

From 2013 WebSocket is universally available.

Libraries and frameworks

The protocol is rapidly adopted:

  • Socket.IO (2010, fallback for legacy browsers)
  • ws — Node.js library, faster
  • Phoenix Channels (Elixir)
  • SignalR (.NET)
  • Django Channels (Python)
  • ActionCable (Rails 5)
  • Spring WebSocket (Java)

Use cases

  • Chat — Slack, Discord, WhatsApp Web
  • Trading — real-time orderbook, live prices
  • Gaming — online multiplayer
  • Collaboration — Google Docs, Figma, Notion
  • Live dashboard — monitoring, observability
  • IoT — telemetry, remote control
  • Push notifications — web apps

Evolution

  • RFC 7692 (2015) — permessage-deflate compression
  • RFC 8441 (2018) — WebSocket over HTTP/2
  • RFC 9220 (2022) — WebSocket over HTTP/3

WebTransport (2021+) on QUIC/HTTP/3 proposes evolution for UDP-like datagrams in browsers, but WebSocket remains the dominant standard.

In the Italian context

WebSocket is at the basis of many Italian real-time applications:

  • Fintech and trading (Banca Sella, Fineco, crypto platforms)
  • eSports and gaming
  • Collaboration (fintech companies, SaaS management software)
  • Health monitoring (telemedicine, patient monitoring)

References: RFC 6455 (December 2011). IETF. Ian Fette (Google), Alexey Melnikov. ws://, wss:// schemes. Full browser adoption 2013. Subsequent extensions RFC 7692, RFC 8441 (HTTP/2), RFC 9220 (HTTP/3).

Need support? Under attack? Service Status
Need support? Under attack? Service Status