Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nowjs stops responding #194

Open
juzerali opened this issue Apr 17, 2012 · 9 comments
Open

nowjs stops responding #194

juzerali opened this issue Apr 17, 2012 · 9 comments

Comments

@juzerali
Copy link

I created a demo chat app (link) from the code available at nowjs.org. Everything works as expected initially. But if I leave the window open for few hours I am simply unable to send any message. There is no http or ws request being sent to the server. I get the following error in browsers javascript console. Tried different browsers, result is the same. is it that nowjs kills the connection after a specified period of time?

Uncaught TypeError: Object #<Object> has no method 'distributeMessage'
now.receiveMessagepagescript.js:5
d.event.handlejquery.min.js:16
d.event.add.m.k.handle.m

If I refresh the page or open the page in another tab things resume as normal.

This might be a possible duplicate of issue #145 but not sure.

@steveWang
Copy link
Contributor

Likely a Socket.IO "feature".

We delete all remote functions when you disconnect, which is why you see the error.

My guess is that Socket.IO forces said disconnect, which doesn't trigger a reconnect.

(also, not a duplicate.)

@juzerali
Copy link
Author

What do you mean by 'disconnect'? Like I said, I simply leave the browser idle, I don't close the window. When does the 'disconnect' event fires?

@steveWang
Copy link
Contributor

Socket.IO timeout.

@juzerali
Copy link
Author

Is there any way to get around it and make a long lived session. Also does any event fires on client-side on disconnect so that I can hide all UIs on disconnect?

@steveWang
Copy link
Contributor

Last time I tried, Socket.IO insisted on having things its way, despite much pleading / tweaking of options. I think the closest I got was setting some settings (closeTimeout and some other ones, perhaps?) to arbitrarily high values. Generally a bad idea.

Regarding your second question: now.core.on('disconnect', cb) does what you'd expect it to.

@juzerali
Copy link
Author

Since nowjs is built on top of socket.io, socket.io's limitations will limit nowjs as well. Can we free nowjs from the dependency on socket.io?

@steveWang
Copy link
Contributor

There was a very brief & short-lived experiment at the end of last summer, but since there was a total of 20 or so developer-hours put into said project, it didn't really go anywhere.

SockJS might be a possibility, but I'm not sure how much effort it would be to switch over.

@juzerali
Copy link
Author

Hmmm, does that mean that with current implementation, nowjs is not production ready?

@jameskeane
Copy link

I have ported now.js to SockJS @ https://github.com/jameskeane/now/tree/sockjs

The only thing I haven't completed yet is session support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants