WebSockets
Opens a two-way live connection to a server, with no prompt.
In one line
Can keep a live two way link to a server, with no pop up
Opens a two-way live connection to a server, with no prompt.
A site can keep a persistent channel to its server for chat, live data or telemetry. It is not covered by CORS, and the connection ends when the tab closes.
What it can and can't do
What the user does: Nothing. It happens when the page loads, like chat, live scores or games.
It can
- Send and get messages in both directions at once
- Keep the link open while the page is open
- Update the page right away with new data
It cannot
- Stay connected after you close the tab
- Reach your files or other apps
- Keep running well in a hidden tab; browsers may slow or drop it
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 5 | 2010-05-25 | None |
| Edge | Supported | 12 | 2015-07-29 | None |
| Firefox | Supported | 11 | 2012-03-13 | None |
| Safari | Supported | 5 | 2010-06-07 | None |
| Safari on iPhone | Supported | 4.2 | 2010-11-22 | All iOS browsers use WebKit |
| Chrome on Android | Supported | 18 | 2012-06-27 | None |
| Samsung Internet | Supported | 1.0 | 2013-04-27 | None |
How a site asks for it
| API | new WebSocket('wss://...'); WebSocketStream (Chrome origin trial history) |
| Browser compat keys | api.WebSocket |
| How access is granted | none |
| What the user sees | None (no browser prompt) |
| Needs a secure context (HTTPS) | No |
| Needs a user gesture | No |
| Activation | none |
| How long it lasts | Lives with the page; closed on unload; BFCache closes it |
| How to take it back | Nothing to revoke (no permission is stored) |
| Inside an iframe | Governed by CSP connect-src; no iframe flag needed |
Typical flow
- Page calls new WebSocket(url)
- Browser performs HTTP upgrade with Origin header
- Messages flow both ways
Data you get
Shape: none
No individual data fields. The signal is the access itself.
Technical limits
- Origin header is sent but no CORS check: servers must validate Origin
- Mixed content: ws:// from an HTTPS page is blocked (Chrome, Firefox, Safari)
- Per-host connection limits: Firefox 200 (network.websocket.max-connections); Chrome around 255 per renderer
- Blocked ports list (about 70 ports such as 25, 110, 6667) applies
- No backpressure in the classic API (messages buffer in bufferedAmount)
- Closed when the tab goes into BFCache and not reconnected automatically
The story
What it is
A page can keep a live two way line open to a server, with no prompt.
For you
You never see it. Chat messages, live scores and multiplayer moves arrive the instant they happen, with no refresh.
For makers
Makers use it for anything live: chat, trading, games, dashboards. It keeps a steady line open, which is faster than asking again and again.
Where you see it
| Type | Example | Apps |
|---|---|---|
| games | A browser shooter or io game sends your position to the server and gets everyone else's back many times a second. | Agar.io, Krunker.io, Slither.io |
| messaging | A chat app delivers a message the second someone sends it. | Slack, Discord web, WhatsApp Web |
| banking | A trading page streams live prices and fills. | Coinbase, Robinhood web |
| live | Twitch chat flows through a live connection, so messages appear as they happen. | Twitch |
| productivity | A shared doc editor sends every keystroke to teammates in real time. | Google Docs, Figma |
| security | A fraud tool streams behaviour signals from a login page to a scoring server as you type. | None named |
Risks
- Always on line
- Streams tracking data
What the platform says
- Mozilla: WebSockets API. MDN says WebSockets let a page and a server send messages back and forth without repeated requests.
Good uses and abuse
Legitimate uses
- Chat
- Live dashboards
- Multiplayer games
Known abuse
- Persistent telemetry channel
- Cross-site WebSocket hijacking when Origin unchecked
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 1 of 5 | How revealing the data is |
| Utility | 5 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | Not rated | Rough identifying entropy, when known |
History
- 2011-10, Chrome 16: RFC 6455 final protocol
- 2016-12, Chrome 57: WebSocket origin check for localhost still permitted
Sources
How well checked: Based on official documentation.