Skip to Content
Platform.Ontology

WebSockets

Opens a two-way live connection to a server, with no prompt.

Works without askingThings a page can doNetwork channelsWeb browsersWhile you use it

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

BrowserStatusFirst versionReleasedNote
ChromeSupported52010-05-25None
EdgeSupported122015-07-29None
FirefoxSupported112012-03-13None
SafariSupported52010-06-07None
Safari on iPhoneSupported4.22010-11-22All iOS browsers use WebKit
Chrome on AndroidSupported182012-06-27None
Samsung InternetSupported1.02013-04-27None

How a site asks for it

APInew WebSocket('wss://...'); WebSocketStream (Chrome origin trial history)
Browser compat keysapi.WebSocket
How access is grantednone
What the user seesNone (no browser prompt)
Needs a secure context (HTTPS)No
Needs a user gestureNo
Activationnone
How long it lastsLives with the page; closed on unload; BFCache closes it
How to take it backNothing to revoke (no permission is stored)
Inside an iframeGoverned by CSP connect-src; no iframe flag needed

Typical flow

  1. Page calls new WebSocket(url)
  2. Browser performs HTTP upgrade with Origin header
  3. 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

TypeExampleApps
gamesA 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
messagingA chat app delivers a message the second someone sends it.Slack, Discord web, WhatsApp Web
bankingA trading page streams live prices and fills.Coinbase, Robinhood web
liveTwitch chat flows through a live connection, so messages appear as they happen.Twitch
productivityA shared doc editor sends every keystroke to teammates in real time.Google Docs, Figma
securityA 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

ScoreValueMeaning
Sensitivity1 of 5How revealing the data is
Utility5 of 5How useful it is to honest apps
Friction0 of 5How much the user has to do
Fingerprint bitsNot ratedRough 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.

On this page