I'm using callbacks in Socket.IO to know when an action is finished. For example:
$loading.show();
socket.emit('delete', {id:123}, function(error){
$loading.hide();
if(error)
alert(error);
});
As I understand it, if the socket is disconnected then the message is queued until the socket connects. Then it is sent. But this could be minutes or even hours, right?
Is there a way to clear a queued message, set a timeout, or otherwise prevent a message from sending if it's been waiting for say 20 seconds?