Handling server going down?

25 views
Skip to first unread message

Brendan

unread,
Jan 4, 2012, 7:32:59 PM1/4/12
to nowjs
hi all,

I want to show some UI while we're not currently able to hit the
server.

Is there a client-side notification for when the server goes down (or
when the connection to it is lost)?

If I kill the server, I see client-side calls failing, and I can
protect against those errors by checking for function existence
first. I also see the now.ready() callback when the server comes
back. But is there some kind of counterpart notification I can listen
for, in my client, so that I can tell the user as soon as they have
lost their connection?

thanks

- Brendan

P.S. Navigating through the docs part of nowjs.org, I've no idea how
you get to http://nowjs.com/doc/now. I only found it via google.

HektoR

unread,
Jan 6, 2012, 2:42:58 AM1/6/12
to nowjs
Hello.
You can use socket.io 'on' event to catch when user disconnected from
server.
now.core.on('disconnect', function() {
console.log('Disconnected from server');
});
For example this event will fire when you kill node process.
> you get tohttp://nowjs.com/doc/now.  I only found it via google.
Reply all
Reply to author
Forward
0 new messages