Is there a way to find out that the io emit socket failed and success, something like ajax: onSuccess, onError callback methods? For the io emit socket, I only find:
socket.emit ('publish', {message: 'test message'}, function (data) {warning ("")})
This callback is only called when the server sends an ack response. But it cannot be used for this situation:
When a message is sent to the server, a bad network or lost connection occurs, which means that the server does not receive this message, therefore, the client callback function is not called.
I want:
When I call the io emit socket, if it fails, I want to retry 3 times.
fcbflying
source share