Keep a live connection between the browser and server for real-time communication.
WebSockets allow a client and server to maintain a persistent connection and send messages to each other whenever needed. Unlike normal HTTP request-response communication, the server can send data to the client without waiting for a new request.
This makes WebSockets useful for chat applications, live notifications, multiplayer games, dashboards, and other real-time features. Building them correctly also requires thinking about connections, authentication, reconnection, message handling, and scaling.
What you'll walk away knowing