Reputation: 1031
I am using simple socket.io functions
socket.on('test', function(data, successCallback) {
successCallback({
"msg": "fetching ur id"
});
successCallback({
"msg": "fetching ur friends"
});
});
I need to fire sequence of multiple callback calls to the client(what server is doing as a message) but second one never fires, it works fine until first callback...can anyone help?
Upvotes: 2
Views: 970
Reputation: 5376
I am not sure where did you get that callback signature from, having a hard time finding it in the socket.io documentation
In any case, you can use emit function to achieve what you need
var io = require('socket.io')();
io.sockets.emit('an event sent to all connected clients');
io.emit('an event sent to all connected clients');
Upvotes: 1