If the connections are dropped quietly (client side does not find out the connection is gone) then how does the long poll case know that the existing poll conn is not going to return any data and a new one needs to be initiated?
Or is it just that long polls generally have short timeout compared with what you might implement for a websocket ping?
Correct, long polling clients generally have timeouts. I wouldn't say they are necessarily shorter or longer than typical websocket ping intervals (I've seen as low as 20 seconds and as long as 2 minutes), but they do need to be there for the client to recover quickly.
Re:You might not need a WebSocket
by saosebastiao on Thursday July 10, 2014 @12:49PM
(#8015662)
It would be nice if you could drop the http overhead for long-polling though, which is the main reason I use websockets.
I'm fine with sending a couple of extra kb if that means I actually get an answer :)
It sounds like EventSource would be a good solution in that case: low overhead, and you'd get auto reconnect for free.
Have you tried http://mosh.mit.edu/?
Mosh is great, I use it on an almost daily basis.
Setting an alias like "alias sssh='mosh'" greatly helps with muscle memory, too (of course, don't override "ssh", you might still need it).
Funny anecdote: I live in a city called "Moshi"
Re:You might not need a WebSocket
by icebraining on Thursday July 10, 2014 @05:02PM
(#8017285)
I don't recommend replacing ssh, but when you do want to shadow a command, you can always call the original using \, e.g.:
\sshThat looks awesome. Will definitely check it out. Broken ssh connections make me sad.
Have you tried socket.io-based web applications on the train? It does pings and reconnecting.
Re:You might not need a WebSocket
by different-opini on Thursday July 10, 2014 @01:30PM
(#8015935)
Do you know of any public socket.io apps?
Etherpad uses socket.io.
Here's one hosted Etherpad: https://etherpad.wikimedia.org/
Dasher (http://dasher.im), uses socket.io. We're using socker.IO-objc for our iOS client: https://github.com/pkyeck/socket.IO-objc
And will be launching a web client in the coming weeks.
So far, so good. We do handle the reconnects ourselves, but otherwise it's been treating us well.
I lose ssh and my websockets, but long-polling apps keep working. Kind of ridiculous, but that's the world we live in.
Making your websockets resilient means pinging and aggressive reconnecting.