How to catch server failure in the client?

socket.io

Solution

Sorry about the bother.. i found the solution:

    socket.on('disconnect', function(){
        HANDLE HERE
    });

Problem

In `socket.io`, when the server is down the client is trying to reconnect to the server and gets the error `GET http:/localhost:8181/socket.io/1/?t=1334276656018`, that, obviously, because the server is not running and cant serve the connection to the client. Is there any way to catch this error in the client side? Something like `socket.on("error", function(...){});` can be very handy in this case... Any suggestions?

Original source