mercredi 19 novembre 2014

Using Socket.io to emit and receive messages on the client


Vote count:

0




So I am using socket.io to send messages back and forth.


I would like to use the socket to raise events and catch them within the client itself. So far, I have tried:



socket.on('news', function(data) {
console.log(data);
});


But, when I ran the following (from my chrome console):



socket.emit('news', {my: 'data'});



I did not get a console.log message.


Could anyone please help me achieve the desired result ?



asked 2 mins ago

myusuf

1,098






Using Socket.io to emit and receive messages on the client

Aucun commentaire:

Enregistrer un commentaire