[Libwebsockets] callback_reasons for browser disconnect

Andy Green andy at warmcat.com
Tue Apr 7 16:48:42 CEST 2015



On 7 April 2015 22:27:04 GMT+08:00, Jeffrey Zhao <chunyong.zhao at qq.com> wrote:
>Dear Sir
>I am wondering what the callback reason type is for browser disconnect
>event.
>
>
>I have tried LWS_CALLBACK_WSI_DESTROY, but found event safari process
>is killed, there is no callback triggered.‍

You can't rely on getting a disconnect indication.

For example an intermediate router network cable falls out, there will be no indication until you try to send something to the remote peer.  Or your Mac catches fire.

So you need to implement something like PING / PONG at intervals to confirm the remote peer is still responsive to cover all cases.

-Andy

>
>
>
>Thanks.
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
>http://ml.libwebsockets.org/mailman/listinfo/libwebsockets




More information about the Libwebsockets mailing list