WebSocket
WebSocket is a network protocol that enables persistent, bidirectional communication between endpoints over a single connection.
HTML5 in Action
The protocol that browser vendors and servers implement to establish and maintain WebSocket connections and pass data.
- How it is used
- Enables bidirectional, event-driven communication between clients and servers for collaborative applications.
- How deep it goes
- Distinguishes the protocol from the JavaScript API and walks through an echo test, while leaving low-level data packing to a library.
- Examples
- Uses a browser-to-server echo test and a collaborative agile planning board.
- What you can do after
- Apply it via WebSocket-Node to test an echo connection and build a collaborative planning board.
Go in Practice, Second Edition
WebSocket is a protocol that provides persistent, bidirectional communication between a client and server over a single connection.
- How it is used
- Enables targeted real-time, bidirectional communication when polling feels stale or inefficient.
- How deep it goes
- Explains persistent TCP connections, HTTP upgrade handling, and a working chat implementation, while deferring advanced package features.
- Examples
- Demonstrates a multi-client chat application with real-time messages and active-member updates.
- What you can do after
- Build it from scratch as a small Go chat service with upgraded HTTP connections and multiplexed client messaging.
Read how Go in Practice, Second Edition explains WebSocket →
Python Concurrency with asyncio
WebSocket is a network communication standard that provides a persistent, bidirectional connection between a client and server.
- How it is used
- Replaces inefficient HTTP polling when applications need timely server-pushed updates.
- How deep it goes
- Explains persistent connections and implements endpoint callbacks, but does not descend into protocol internals.
- Examples
- Uses a live user counter, a Starlette endpoint, and a browser JavaScript client.
- What you can do after
- Build it with Starlette to broadcast changing application data without repeated HTTP requests.
Read how Python Concurrency with asyncio explains WebSocket →
Also covered in
- Vanilla WebIn early access (MEAP)
- Build Python Web Apps with Streamlit
- Enterprise RAGIn early access (MEAP)
- The Design of Web APIs, Second Edition
- AI Agents in Action, Second Edition
- Digital Twins in Action
- Django in Action
- Fast by DefaultIn early access (MEAP)
What to know first
- HTTPHTTP is an application-layer protocol that defines request-and-response communication for transferring resource representations and related metadata between networked systems.
- RESTREST is an architectural style for distributed systems that organizes interactions around identifiable resources and their representations, using a uniform interface and constraints such as statelessness and cacheability.
- workerA worker is a person, process, thread, machine, or other execution resource that performs assigned work as part of a larger system or activity.
- web applicationA web application is software that provides functionality through web technologies and is accessed over a network, typically through a browser or other web client.
Related concepts
- pollingalternative to · Polling is a technique of repeatedly checking or querying a resource, system, or condition to detect information, events, or changes in state.
- Starletteused by · Starlette is a lightweight Python ASGI web framework and toolkit for building asynchronous web applications and services.
- server-sent eventscontrasts with · Server-Sent Events is a web standard for streaming text-based event updates one way from a server to a client over HTTP.
- ASP.NET Core SignalRused by · ASP.NET Core SignalR is a Microsoft library for real-time, bidirectional communication between servers and connected clients.
- stream processinguses · Stream processing is the incremental processing of data items as they become available, without requiring the complete dataset to be present first.
Questions about WebSocket
What is WebSocket?
WebSocket is a network protocol that enables persistent, bidirectional communication between endpoints over a single connection.
Which Manning books explain WebSocket?
HTML5 in Action, Go in Practice, Second Edition and Python Concurrency with asyncio.
What should I know before learning WebSocket?
Manning books that teach WebSocket usually introduce HTTP, REST, worker and web application first.
What is the difference between WebSocket and polling?
WebSocket is a network protocol that enables persistent, bidirectional communication between endpoints over a single connection. Polling is a technique of repeatedly checking or querying a resource, system, or condition to detect information, events, or changes in state.
What is WebSocket a kind of?
WebSocket is a kind of network protocol. A network protocol is a defined set of rules and message formats governing how systems communicate and exchange data over a network.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


