Grokking Node.js
Vote

0% completed

​

Broadcasting and Handling WebSocket Events

When ana sends a chat message, who should receive it? Everyone except ana, because her page already shows what she typed. When ben joins, the welcome text is for ben alone, and the "ben joined" notice is for everyone else. A message in the js channel goes only to the people in that channel. Each event in a chat app has its own audience, and Socket.IO has a method for each one.

This lesson extends the Socket.IO chat server with those methods. Three users connect in order, ana, ben and cy, and every output below comes from a test run with those three clients.

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content