Backend, Data & Security More detail A1 · Official standard Platform: Web

WebSocket

A WebSocket keeps a two-way connection between a web app and a server. Either side can send messages while it is open.

See how it works
You might call it web socketbidirectional socketpersistent connection

See how it works

Original worked exampleWebSocket

Another example

Two teammates edit one board. Each saved move reaches the other screen through the open connection.

Main parts

  1. 01Opening handshake
  2. 02Ready state
  3. 03Incoming message
  4. 04Outgoing message
  5. 05Close and app recovery

Use it when

Use it for chat, collaboration, or live events that need messages in both directions.

Do not use it when

Use a normal request for an occasional simple read. WebSocket has no built-in authentication, so your app must add access checks and recovery rules.

Name used in code

CONNECTING -> OPEN <-> messages -> CLOSING -> CLOSED

Before you ship

Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback.

Request you can copy

Outcome: Design or review WebSocket for this system while keeping data correct, secure, and easy to operate. User context: Two teammates edit one board. Each saved move reaches the other screen through the open connection. Technical concept or control: WebSocket. Why it fits: Use it for chat, collaboration, or live events that need messages in both directions. Do not use it when: Use a normal request for an occasional simple read. WebSocket has no built-in authentication, so your app must add access checks and recovery rules. Engineering requirements: Define inputs, outputs, contracts, and rules that must always hold. Set authorization and input checks. Define failures, timeouts, retries, one-time effects, data moves, and compatibility limits. Operations: Add useful signals and logs that hide sensitive data. Set capacity limits and write an operator guide. Test recovery and rollback. Acceptance criteria: Contract and failure-path tests pass. Data and authorization rules still hold during retries and partial failures. Check performance limits, monitoring, recovery, and rollback. Evidence and limits (evidence boundary): The standard covers only the listed scope. It does not choose the visual style, product decision, or Vibulary example. Unknowns to confirm: Where the code runs, data stores, traffic shape, consistency needs, and the security boundary. Also confirm the compatibility period, service goals, and rollback limits.

Check this request

Review the current use of WebSocket. Definition: A WebSocket keeps a two-way connection between a web app and a server. Either side can send messages while it is open. Release checks: Check contracts and invariants, authorization, and input limits. Test retries, one-time effects, timeouts, and partial failures. Verify data integrity, compatibility, monitoring, recovery, and rollback. Before changing code, report the evidence you found, gaps, severity, and the smallest safe fix.

A1
How official is this term?

Official standard

A named standard sets the rules described on this page.

The standard covers only the listed scope. It does not choose the visual style, product decision, or Vibulary example.

Scope
Browser WebSocket API
Document status
living standard
Checked on
2026-07-30

Evidence sources & scope

Authority source + Term reference · WHATWG · living standard WebSockets Standard — 3. The WebSocket interface 3. The WebSocket interface Scope: Browser WebSocket API and connection states; direct scope: 3. The WebSocket interface Role here: Direct term reference Source covers: canonical name, definition, semantics, implementation Authority source · WHATWG · living standard WebSockets Standard Scope: Browser WebSocket API and connection states Role here: Authority within stated scope Source covers: canonical name, definition, semantics, implementation Background source OWASP — WebSocket authentication and authorization Role here: Helpful background, not a definition

Copy it yourself

The browser could not copy this. Select the request below and copy it yourself.