Question

As this question, In code.google.com/p/go.net/websocket, it needs to implement keep-alive by self.

So what is proper time span that web-socket to keep alive? Thanks!

Was it helpful?

Solution

Generally keeping the keep-alive just under 60 seconds is good idea. (Heroku for instance requires you to send some data at least every 55 seconds) So sending a ping/pong every 50 seconds should keep your connection alive. Do note that you might have to choose a shorter interval depending on your server stack, any web accelerators, proxies and caches. A NAT router also influences the interval. Most of the time 50 seconds will work but 25 seconds usually does the trick when 50 doesn't.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top