Search WebSocket.org
Independent WebSocket reference

WebSocket.org

The independent, practitioner-built reference for WebSocket technology. Protocol internals, production patterns, scaling guides, and honest protocol comparisons with real code.

ws-monitor — websocket.org
ws://websocket.org/demo
uptime 00:00:00 RFC 6455
Latency
12ms
Messages
0 sent
0 recv
Frames
TEXT 0
BINARY 0
PING/PONG 0
Message Feed LIVE

Explore WebSockets

Understand the Protocol

From HTTP upgrade to binary frames — the complete picture.

Build Something

Hands-on guides from first connection to production scale.

Compare Protocols

Not everything needs a WebSocket. Pick the right tool.

By Language

Production-ready patterns for your stack.

Use Cases

Real-world patterns for common WebSocket applications.

Explore the full guide library — implementation patterns, framework integrations, and more.

Browse all guides

Try It

WebSocket Echo Server

Test WebSocket connections in real time. Send messages and see them echoed back instantly — no signup, no setup.

Try it now

WebSocket vs SSE vs HTTP

Answer a few questions about your use case and get a protocol recommendation.

Find your protocol

Why WebSockets?

HTTP

One request, one response. Connection closes. Every interaction has overhead.

C
S
S
C
C
S
S
C

Server-Sent Events

Server streams to client only. Great for push — can't send back.

S
C
S
C
S
C
S
C

WebSocket

Full-duplex, persistent. Both sides send whenever they want.

C
S
S
C
C
S
S
C
C
S

What's New

New Guide

WebSockets and AI

Token streaming, tool-call interleaving, bidirectional agent communication. How modern AI systems use WebSockets — and when they don't.

Deploy and Operate

Common Questions

What is a WebSocket?
A WebSocket is a persistent, full-duplex communication channel over a single TCP connection defined by RFC 6455. The connection starts with an HTTP upgrade handshake, then switches to a lightweight binary frame format. Unlike HTTP request-response, the server can push data to the client at any time without the client asking for it. That makes WebSockets the foundation for live chat, real-time dashboards, multiplayer games, collaborative editing, and AI token streaming. The protocol has been stable and universally supported since 2011. Read our Road to WebSockets guide for the full history.
When should I use WebSockets instead of HTTP?
Use WebSockets when your application needs low-latency, bidirectional data flow between client and server. Concrete use cases: live chat, multiplayer games, collaborative editors, financial tickers, IoT telemetry, and AI token streaming where users send prompts and receive partial responses in real time. Stick with HTTP for standard page loads, REST API calls, file uploads, and any interaction where the client initiates every exchange. If you only need server-to-client updates and the data rate is low, SSE is a simpler alternative. For detailed trade-offs see our WebSockets vs HTTP comparison.
Are WebSockets supported in all browsers?
Yes. Every modern browser has supported WebSockets since at least 2013. Chrome 16+, Firefox 11+, Safari 7+, Edge 12+, and all mobile browsers. Global support is above 99% according to caniuse.com. The only scenario where WebSockets get blocked is behind certain corporate proxies that strip the HTTP upgrade header. Libraries like Socket.IO handle that by falling back to HTTP long-polling, or managed services like Ably negotiate the best available transport automatically. See our full browser support table.
How do WebSockets compare to Server-Sent Events (SSE)?
SSE is a unidirectional protocol: the server pushes data to the client over a standard HTTP connection. It is simpler to set up and works through most proxies without configuration. WebSockets provide full-duplex bidirectional messaging, binary data support, and lower per-message overhead. For AI streaming, SSE works when traffic is purely server-to-client, but WebSockets win when you need client-to-server signals like cancellation, live steering, or tool-call responses during generation. Our WebSockets vs SSE comparison covers the decision matrix in detail.
What is the WebSocket protocol?
The WebSocket protocol (RFC 6455) defines a framing layer over TCP. A client sends a standard HTTP request with an Upgrade: websocket header. If the server agrees, the connection switches from HTTP to the WebSocket frame format. Each frame carries an opcode (text, binary, ping, pong, close), a payload length, and optional masking. The result is a persistent, low-overhead channel that avoids the cost of repeated HTTP handshakes. For the full technical breakdown, read our WebSocket Protocol guide.