Take the 2-minute tour ×

I use node.js and socket.io. When i do refresh the page - the user connection is interrupted. How do I solve this problem?

I do not want, when the user to switch between pages disconnected.

Thanks for the advice!

share|improve this question
Then use a single page application –  Raynos Dec 30 '11 at 21:43
@Raynos I need a multi-page application. Is there any solution? –  Jenan Dec 30 '11 at 21:48
persist the socket id in localStorage and reconnect when you change page –  Raynos Dec 30 '11 at 21:59
Try using hash links to not have users load another page and instead load content into the current page. github.com/flatiron/director –  DeaDEnD Dec 31 '11 at 2:51
add comment

1 Answer

Personally, I would go for the single page application approach myself. But just fancying an alternative solution..

You could try using socket.io with an essentially hidden frame. In one frame, you maintain your connection while the user is still able to navigate in the other.

You'll have to have some gluecode to pass messages between the frames, but that should be trivial I think.

share|improve this answer
add comment

Your Answer


