[Libwebsockets] Callback when timeout during connection establishment ?

Andy Green andy at warmcat.com
Tue Aug 12 00:40:34 CEST 2014



On 11 August 2014 23:56:47 GMT+08:00, bjorka adinov <adinov.bjorka at gmail.com> wrote:
>Not real world case. I only simulate a case where the server is doing
>something that might take several seconds between libwebsocket_service
>calls, if the connection times out I try to reconnect.

I see... it's true if that happened, the server will see that a lot of real time has passed and use that to respond to anything pending as timed-out.

You can increase the timeouts... most of the timeouts reference this for the limit, currently 5s

http://git.libwebsockets.org/cgi-bin/cgit/libwebsockets/tree/lib/private-libwebsockets.h#n240

Otherwise it has to be the responsibility of the client to notice he was killed and reconnect.

-Andy

>Thank you
>
>
>On Sat, Aug 9, 2014 at 5:51 PM, Andy Green <andy at warmcat.com> wrote:
>
>>
>>
>> On 9 August 2014 18:30:43 GMT+08:00, bjorka adinov <
>> adinov.bjorka at gmail.com> wrote:
>> >Hello Sir,
>> >
>> >As far as I know there is no callback when connection timeouts
>during
>> >connection establishment. Is there a way to detect that a connection
>is
>> >timeout ?
>>
>> Lws should cover all the stages of the connection, both as client
>trying
>> to make the connection and server trying to process it, with an lws
>timeout.
>>
>> If one of these times out, the socket will be closed.
>>
>> Because no websocket upgrade was completed, there won't be a normal
>close
>> callback.
>>
>> You might get a LWS_CALLBACK_CLOSED_HTTP depending on when the
>connection
>> failed.
>>
>> Otherwise the connection will just be closed without the user
>callback
>> getting informed.
>>
>> Do you have a case where the user code needs to know about failed
>> connection attempts?
>>
>> -Andy
>>
>> >Thank you, much appreciated
>> >
>> >
>>
>>------------------------------------------------------------------------
>> >
>> >_______________________________________________
>> >Libwebsockets mailing list
>> >Libwebsockets at ml.libwebsockets.org
>> >http://ml.libwebsockets.org/mailman/listinfo/libwebsockets
>>
>>




More information about the Libwebsockets mailing list