Sending Messages

In notebook:
FrontEndMasters Real-Time Web with Node.js
Created at:
2015-10-14
Updated:
2015-10-14
Tags:
JavaScript libraries
4:11:06 - 4:19:49 Sending Messages Kyle tasks the audience with adding a setInterval method that will transmit a message to any client connected to the socket. He uses the emit() method to send the message.on the server:

​function handleIO(socket){    
  // "client connected"  
  // ...  
  socket.emit("hello", Math.random());
  //...

on the client:

socket.on("hello",function(data){
     console.log(data);
});