Summary
We learned a lot in this chapter about connecting browsers to WebSockets. The messages and events from one browser are sent to all connected browsers in almost real time.
Specifically, we learned how WebSockets provide real-time events by drawing on an existing multiplayer sketchpad. It shows drawings from other users who are connected. We chose Node.js as the server-side WebSocket server. By using this server, we can easily build an event-based server to handle WebSocket requests from browsers. We discussed the relationship between the server and a client, which compares WebSockets with other approaches such as long-polling. We built an instant chat room application. We learned how to implement a server script to send all incoming messages ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access