In 0.9.16, I use socket.emit with callback so that the chat server return some data and I can handle the result as per the acknowledgement. But after the upgrade to 1.3.5 I've found a error in console like this
Uncaught TypeError: Cannot read property 'apply' of undefined.
I've done something like this,
From web
socket.emit('userToUser', { 'usename': 'John',
'message': 'hi'
}, function(callback){
//callback handled
});
Chat Server
socket.on('userToUser', function(content, callback){
//do something
if(callback) return callback({'result':'success', 'messageid':content.messageid, 'chatid':content.chatid});
});
When I removed the callback from client side, there is no error. So I believe there will be some changes to be done in the callback.
I'm getting the acknowledgement and the chat is working properly, but my concern is about the console error which leads to socketio.js
Socket.prototype.onack = function(packet){
debug('calling ack %s with %j', packet.id, packet.data);
var fn = this.acks[packet.id];
fn.apply(this, packet.data);
delete this.acks[packet.id];
};
Guys, please help