I am trying to use confirmations with socket.io as defined in http://socket.io/#how-to-use "Sending and receiving data (confirmations)".
My client code looks like
sio.emit('ferret', 'tobi', function (data) {
console.log(data);
});
And my server code:
socket.on('ferret', function (name, fn) {
fn('woot');
});
But I get an error message that breaks my node server:
fn('woot');
23:13:48 web.1 | ^
23:13:48 web.1 | TypeError: undefined is not a function
Which I find strange, because if I add:
console.log(name);
console.log(fn);
the name will be written by Tobi, but for what reason fn registers undefined.
Any info would be awesome!
source
share