Performance: Broadcasting to rooms
MEDIUM IMPACT
This concept affects how efficiently messages are sent to groups of clients, impacting server response time and network usage.
io.to('roomName').emit('event', data);
io.emit('event', data);| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Broadcast to all clients (io.emit) | N/A (server-side) | N/A | N/A | [✗] Bad |
| Broadcast to room (io.to(room).emit) | N/A (server-side) | N/A | N/A | [✓] Good |