Automatic heartbeating for WebSocket and WAMP-over-WebSocket

#1

Hi,

Autobahn>Python and Crossbar.io (both trunk, will be in next releases) now implement automatic WebSocket heartbeating ("WebSocket ping/pong").

This is useful in two ways:

* fast detection of lost connections (network connection failures and such)
* keeping mobile connections in a fast/low-latency state

There are 3 knobs to control this stuff:

"auto_ping_interval"
"auto_ping_timeout"
"auto_ping_size"

Of course there is a tradeoff: doing ping/pong at a higher frequency means broken connections are detected faster, but it'll also mean more wire level traffic.

No free lunch - as always.

Refs:

https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/pingpong_keepalive

https://github.com/crossbario/crossbar/wiki/WebSocket-Options#production-settings

Cheers,
/Tobias

Note: We might still want ping/pong at WAMP level, independent of WebSocket, since WAMP can run over non-WebSocket transports as well.

But above should cover a lot of practical use cases already.

0 Likes