How can i detect if a message did not reach my node.js+socket.io server. I have an emit from the server for message sent success.
socket.on('message', function(msg) {
var sendersusername = msg.source;
if (io.sockets.sockets[socket.id] != undefined)
{
io.sockets.sockets[socket.id].emit('messagesentsuccess',
{"user": msg.target,
"message":msg.message
});
}
});
from this code i get a success message when a message reaches the server. How do i know if the message could not be sent to the server?
you can use
socket.on('error', function (err) {
console.log(err);
});
to detect errors`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With