Broadcasting and Rooms

A ws server broadcasts by sending one message to every open client in wss.clients, greets a client who connects late with the current state, keeps rooms as a Map of Sets so a message reaches only one group and cleans up when a client closes, and is tested with real ws clients on a port the test picks.

By

Updated

Cheat sheet: Broadcasting and Rooms
Category
Node.js
Level
Journeyman
Tags
Broadcast, map() (javascript), node:test, nodejs, Set (javascript), Socket.IO, web-development, WebSocket Room