Skip to content Skip to sidebar Skip to footer

Socket.io Server-side Callback

I've successfully made a callback with http://socket.io when the client calls the server socket.on('event', function(data, fn){ fn(null, true); } I was wondering if its possible t

Solution 1:

The emit and on works exactly same on both sides: client and server. So if you emit to client-socket on server side, then if on client-side you are subscribed to that event, it will trigger it. And vice versa.

What you are confused by is that server has one socket that is listening one, and many connections with socket per client.

While client has only one socket to talk to server.

Examples here: http://socket.io/#how-to-use Do bi-directional messages, and you need to clearly read them before denying that there is no bi-directional messaging.

Post a Comment for "Socket.io Server-side Callback"