[Libwebsockets] How to properly handle LWS_CALLBACK_CLIENT_CONNECTION_ERROR?

Duane Butler Duane.Butler at calix.com
Wed Jun 27 16:15:34 CEST 2018

Using libwebsockets version 2.4.1

My application creates a context (lws_create_context) and a socket (lws_client_connect_via_info).

When the connection fails (or is closed by the other end), I want to retry again after a random timeout.

What is the proper way to code this?

Currently, I've tried the following:

  *   Call lws_client_connection_via_info again (reusing existing context)
  *   Call lws_context_destroy and start over

These methods work, but result in a memory leak. I have a situation where I cannot connect for a couple days and the memory leak becomes significant.

Thanks in advance for the help.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20180627/c3ef1a81/attachment.html>

More information about the Libwebsockets mailing list