vendredi 27 mars 2015

Use socket.io without having to use 'connection'

This is the code that works:



io.sockets.on('connection', function (socket) {
socket.on('event', function(data) {
//This listens for 'event', but also listens for 'connection'
});
});


I want to remove the .on('connection') because it messes with the rest of my server.


I would imagine that this would work:



io.sockets.on('event', function(data) {
//This even should work, right?
});


My main goal is to listen for the event called event, without having to listen for connection


Aucun commentaire:

Enregistrer un commentaire