[Libwebsockets] Clean Reconnect not working

Deric Panet-Raymond dpraymond at satcomdirect.com
Wed Apr 8 16:59:06 CEST 2015


I am trying to design a reconnect sequence using libwebsockets for an application and I’m encountering an issue where it seems like the callbacks registered by the protocol aren’t being executed after a reconnect.  My current sequence has moved the connection to a function called open_connection where I create a libwebsocket context and perform the connect in a loop as the application will most likely start prior to the Network connection being live.  Our connection environment can be sporadic, hence the need for automatic connection and reconnect after disconnect.

Once it’s connected everything appears to work well, it seems to survive one or two disconnects, I have a LWS_CALLBACK_CLOSED case which destorys the libwebsocket context and resets some state variables, then calls open_connection again.

Can you think of something I might be missing that would cause the open_connection to fail after a couple of connect/disconnect cycles, is there a cleaner way to implement the reconnect?


Deric Panet-Raymond

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libwebsockets.org/pipermail/libwebsockets/attachments/20150408/13d25d05/attachment.html>

More information about the Libwebsockets mailing list