Websockets and uwsgi - detect broken connections client side? -


i'm using uwsgi's websockets support , far it's looking great, server detects when client disconnects , client when server goes down. i'm concerned not work in every case/browser.

in other frameworks, namely sockjs, connection monitored sending regular messages work heartbeats/pings. uwsgi sends ping/pong frames (ie. not regular messages/control frames) according websockets spec , client side have no way know when last ping received server. question this:

if connection dropped or blocked proxy browsers reliably (ie. chrome, ie, firefox, opera) detect no ping received server , signal connection down or should implement additional ping/pong system connection detected closed client side?

thanks

you totally right. there no way client side track or send ping/pongs. if connection drops, server able of detecting condition through ping/pong, client let hung... until tries send , underlying tcp mechanism detect other side not acknowledging packets.

therefore, if client application expects "listening" of time, may convenient implement keep alive system works "both ways" stephen explains in link posted. but, keep alive system part of application layer, rather part of transport layer ping/pongs.

for example can have message "{token:'whatever'}" server , client echoes 5 seconds delay. client should have timer 10 seconds timeout stops every time messages received , starts every time message echoed, if timer triggers, connection can consider dropped.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -