[Libwebsockets] How to "disconnect"?

Mike M lws14 at mordent.com
Tue Jul 29 19:45:30 CEST 2014

I think this is what keepalive is for when you create the context.


On 07/29/2014 11:44 AM, Carlos Sánchez wrote:
> I've make a client application that is working fine (since now) but 
> testing communication issues I've reached a point where I can't solve 
> a connection problem.
> Once connected and after many data exchange without problems, I've 
> disconnected the device from the internet without loosing the link 
> (I've removed the "output" cable of the switch where device is 
> connected). So, there is no link down detection and libwebsocket 
> doesn't detect the disconnection from the server. After two minutes, 
> my "ping" timer fires and sends a LWS_WRITE_PING without any error and 
> of course after another one minute the "pong" timer fires and detect 
> the missing server connection.
> I need to "disconnect" and "connect" again ("reconnect"), but I can't 
> found the analogous function of libwebsocket_client_connect().
> How can I force a "disconnect" without destroying the context, and if 
> possible reuse the connection?

More information about the Libwebsockets mailing list