I am using socket.io for node platform with v2.0.3.
Below code working before a week
socket.broadcast.to(msg.receiverID).emit('new message', { "username": msg.username, "message": msg.message, "to": msg.to, "receiverName": msg.receiverName, "senderName": msg.senderName, "dateTime": data.created });
It's working and emit the message to a single receiverID.But now it doesn't work even i have not modified the previous code. But we have found one of the solution for this is to try the io object to emit the message as mentioned below:
io.to(msg.to).emit('new message', { "username": msg.username, "message": msg.message, "to": msg.to, "receiverName": msg.receiverName, "senderName": msg.senderName ,"dateTime":data.created});
Why this conflicts is socket.broadcast.to() is depricated or unused as of io.to().