I am building a simple chat. I am using the websocket lib socket.io because it has a great server/client implementation.
My client is on mobile and therefore has a very unstable network connection. I have read something about acknowledgment functions which could be passed with an emit, to execute code once the socket "transaction" is done. But building an error handling on top of that would be very uggly.
I have also read about the .on('error' implementation that catches errors.
The problem here is: how do I seperate between an unsuccessfuly sent message (.emit) and a temporarily lost socketconnection. I dont care about losing the socketconnection because i set it up to reconnect once its lost.
I hope my situation got clear. Thanks in advance.
EDIT:
What I am looking for is something like this on the clientside:
socket.on('error', function(data){
alert(data.emitData.msg+' could not be sent: '+data.emitID);
});
I am going to start taking a closer look at the API myself in the meantime