What is WebSocket?
WebSocket supports a persistent, bidirectional message channel between client and server, unlike a single HTTP request-response exchange.
How it works and where it is used
1. How it works A connection can begin with an HTTP upgrade handshake, then exchange frames. The browser API exposes message events; wss uses TLS. 2. Applications and examples Chat, games and live dashboards are examples. A persistent channel helps frequent updates, while plain HTTP may be simpler for infrequent changes.
Limits and good practice
3. Limitations and security Long-lived connections consume resources. Authentication, per-message authorization and size or rate limits are necessary. 4. Practical considerations Plan disconnects, retries, heartbeat and state recovery. Validate messages and check browser origin and session security.