Wakanda websocket onclose not firing on network disconnect -
i have websocket implementation on wakanda server. tracking connected browsers server side. when reload page, onclose event of websocket expected.
i have expected when break network connection have event fire. misunderstanding? there way have function fire when network connection lost websocket client?
for reference, using wakanda 10.
to understand problem give details websocket connections :
- it uses tcp
- if remote client(browser instance) closes tcp connection gracefully server notified (fin)
- if remote client crashes, os running client application notifies server (rst)
- if tcp connection open between server , client connection assumed open if there absolutely no exchange of data while unless keepalive activated.
- the websocket spec adds close message server/client can handle graceful close
- the websocket spec adds ping/pong message exchange not impose timeout. rfc :
upon receipt of ping frame, endpoint must send pong frame in response, unless received close frame. should respond pong frame practical.
- in wakanda's implementation of rfc respond received
ping
messages don't send our ownping
messages
this can new feature can either :
- expose
ping
method throughmessage port
pong timeout
- add websocket keepalive option configurable timeout @ moment of adding
websocket handler
. - add tcp keepalive option configurable timeout @ moment of adding
websocket handler
.
for time being, can send message of choice client side every n seconds , wait response timeout of t. if don't receive response can assume connexion lost , close it.
Comments
Post a Comment