[Libwebsockets] Is ws_ping_pong_interval the only way to find out dis-connected clients ?
andy at warmcat.com
Fri Feb 10 21:37:16 CET 2017
On February 11, 2017 1:21:02 AM GMT+08:00, hanguofu <hanguofu at 163.com> wrote:
>Hi , there :
>I would like to maintain a list of online clients at the server side.
>( Both of the clients and the server implement LWS library version
>2.1.0. ) So at the "LWS_CALLBACK_CLOSED" callback of the server , I
>deleted the dis-connected peer from the list. Unfortunately , sometimes
>it does not work : the peer dis-connected without server's notice.
What happens when you get that situation?
>Is the ping-pong feature the only way out ?
More exactly under some conditions it's only when you try to write to a silently "gone" peer that you can realize he's gone. The ping / pong stuff will guarantee to provide writes on idle connections at intervals, so lws can know they are gone with a maximum latency and close them.
More information about the Libwebsockets