i have a case where clients connect to a node.js server running nowjs and remain connected for a fairly long time (about 30 minutes). on some browsers though the connection gets dropped after a while and the client disconnects.
i implemented a disconnect handler on the client side like this:
now.core.on('disconnect', function () {
// we should reconnect here, maybe after a short timeout
});
what i am unclear about is how exactly to trigger a reconnect. this might be something blatantly obvious to experienced users but i didn’t manage to figure this out.
the now.js script initializes on page load and after that i can use the now object, but i can’t figure out how to repeat this process without reloading the page.
thanks!
Yes, automatic reconnects are supported with NowJS, as of v0.6.1.
The website needs to be updated, but there’s a blog post detailed the implementation of reconnects in NowJS here.