[ACCEPTED]-Are Websockets adapted to very long-lived connections?-netty
Absolutely, but there are a couple of caveats.
If 18 you want your connection to stay alive continuously 17 for long periods then I would suggest adding 16 some logic to your client to reconnect when 15 the onclose event happens (you will want 14 some sort of back-off to prevent a tight 13 reconnect loop for certain situations).
You 12 may also want to send a ping message (a 11 simple message that is ignored) every 5 10 minutes or so to prevent idle timeouts (which 9 can happen at several places along the network 8 connection). TCP network stacks are often 7 set to kill connections that have been idle 6 for 2 hours and ping messages will keep 5 them alive. Browsers are allowed to implement 4 ping messages that are invisible to the 3 application but this is optional so you 2 should implement your own at the application 1 level if you want to guarantee this behavior.
Note: Ping/Pong frames are part of the WebSocket spec but as yet are not available via the API
Long-lived connections is what WebSocket 11 was designed for. Depending on how your 10 clients connect, those connections might 9 nevertheless be limited in lifetime, i.e. on 8 retail DSL connections, there often is a 7 forced reconnect every 24h at least.
Then, what 6 you seem to desire is something like publish 5 and subscribe messaging pattern on top of 4 raw WebSocket (which only provides bidirectional 3 messaging). Have a look at: http://wamp.ws (and http://autobahn.ws).
Disclaimer: I 2 am original author of WAMP and Autobahn 1 and work for Tavendo.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.