Nightlight icon indicating copy to clipboard operation
Nightlight copied to clipboard

More robust handling of poor connections

Open metasoarous opened this issue 7 years ago • 4 comments

First of all: Wow. Nightlight is amazing. Wonderful work :-) I used this tool while I was back in Seattle and it was marvelous and magical. Now for the issue..

I'm presently visiting family in Indonesia and even on mostly decent internet connections (for here), Nightlight can be a bit painful to use. The editor and preview disconnect frequently, and often Figwheel seems not to initialize properly. On spottier internet connections, it's almost unusable, having to reload the editor every minute or two, and the preview after every update. Major buzz kill.

I imagine that some of the issue is just that the deployment zone the app is in is in the states. And I can see that it would be a bit of a hard sell for a gratis project like this to start putting up multi-zone deployments. But I wonder if there are some timeouts that couldn't be adjusted so that things don't disconnect so quickly? It would be wonderful if this tool could enable those in the "developing" world (I hate that term, but hey) to benefit from the awesomeness that is Nightlight.

metasoarous avatar Mar 22 '17 09:03 metasoarous

I realized I didn't make it clear that this issue is specifically for nightcoders.net. I didn't see a project for that, so I figured this was the right place to bring up the issue.

metasoarous avatar Mar 22 '17 10:03 metasoarous

Interesting! The server is actually in Germany, though that may not be any better for you. When you say it disconnects, you mean that you see a message that says "Connection to server has been lost"? That will display if the web socket connection to ws://nightcoders.net/USER_ID/PROJECT_ID/code/status is closed. The preview's auto-reload functionality is also using a web socket.

Could there be something that is prematurely closing web socket connections in particular? I would be surprised if the underlying TCP connection is timing out, but I suppose it's possible. I don't have any artificial timeouts anywhere that I know of, other than an nginx timeout which terminates an inactive connection after 6 hours. Perhaps there is something in nginx I can do to make the TCP connections more forgiving?

oakes avatar Mar 22 '17 12:03 oakes

Yup; that's the message I see.

Interesting indeed! I don't know of anything that would be closing those socket connections. I'm totally clueless regarding nginx. Next time I'm tinkering I'll open up the dev console and take a snapshot of any issues for you.

metasoarous avatar Mar 22 '17 12:03 metasoarous

Yeah please do. In particular, if you keep the network tab open in chrome's inspector and look for the item called status, once it loses connection again it should hopefully give some info such as a status code.

oakes avatar Mar 22 '17 14:03 oakes