GlossaryProtocolsIntermediate

WebSocket

WebSocket is a protocol that opens a persistent, two-way connection between a browser and a server. Unlike normal HTTP requests, it lets data flow in both directions continuously without re-connecting each time.

Last updated June 8, 2026

Definition

WebSocket is a full-duplex communication protocol that runs over a single, long-lived TCP connection. It begins life as an ordinary HTTP request that is then "upgraded" via the Upgrade: websocket header, after which both client and server can push messages to each other at any time.

How WebSocket works

After the initial HTTP handshake, the connection switches to the ws:// or secure wss:// scheme. The socket stays open, so the server can stream live data (chat messages, stock prices, sports scores) instantly instead of the client repeatedly polling.

Why it matters for scraping and proxies

  • Many modern sites load dynamic data over WebSocket rather than REST, so scrapers must capture wss:// traffic directly.
  • Persistent connections complicate IP rotation because switching IPs mid-session drops the socket.
  • SOCKS5 proxies tunnel WebSocket traffic more reliably than basic HTTP proxies.

Understanding WebSocket is essential when scraping real-time dashboards, trading platforms, or live odds feeds where data never appears in the initial HTML.

Examples

1

Live chat apps streaming messages over wss:// connections

2

Crypto exchanges pushing real-time price tickers to the browser

3

Sports betting sites delivering live odds via WebSocket frames

Common Use Cases

Scraping real-time data feeds that bypass standard REST endpoints
Maintaining a sticky proxy session for the life of a socket
Monitoring live dashboards or trading platforms
Reverse-engineering app traffic to find hidden WebSocket APIs

Frequently Asked Questions

Yes. You capture the wss:// frames using a headless browser or by replaying the WebSocket handshake directly, since the data never appears in the page HTML.
Yes, but SOCKS5 proxies handle WebSocket tunneling more reliably than basic HTTP proxies, and you should use a sticky session to avoid dropping the socket.
ws:// is an unencrypted WebSocket connection, while wss:// is encrypted with TLS, just as HTTPS encrypts HTTP.