Automatic sockJS reconnect function