WebSocket
What is WebSocket?
WebSocket: A protocol providing a persistent two-way communication channel between client and server over a single TCP connection. Used for real-time features like chat, live updates, and collaborative editing. A WebSocket is a persistent, two-way connection between a browser and a server. Once it is open, both sides can send messages at any time, without the browser making a new request for each update.
Frequently asked questions about WebSocket
How is WebSocket used in practice?
That makes it the natural choice for real-time features: chat, live notifications, dashboards that update instantly, collaborative editing and multiplayer games.
What should you keep in mind with WebSocket?
WebSockets need a server that keeps many connections open, which works differently from normal request-response hosting. In the Laravel world, Reverb, Pusher and Ably handle this, with Laravel Echo on the front end. Plan for reconnects, since connections drop on mobile networks, and authenticate private channels. For simple one-way updates from server to browser, server-sent events are a lighter alternative.
At a glance
| Category | Core glossary |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |