oakes / Nightlight

An embedded editor for Clojure
https://sekao.net/nightlight/
The Unlicense
788 stars 35 forks source link

More robust handling of poor connections #25

Open metasoarous opened 7 years ago

metasoarous commented 7 years ago

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 commented 7 years ago

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.

oakes commented 7 years ago

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?

metasoarous commented 7 years ago

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.

oakes commented 7 years ago

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.