[Libwebsockets] Client App | Recreating websocket connection faster

Andy Green andy at warmcat.com
Mon Jul 18 06:26:49 CEST 2016



On July 18, 2016 12:22:15 PM GMT+08:00, Harshad Italiya <harshaditaliya at gmail.com> wrote:
>Andy:
>
>Thank you for the suggestion. After your suggestion I looked into
>test-client.c and I get to know about checking the version and I can
>see
>the one I was using was *1.6.0 *while the latest one is I think *2.0.0
>*
>correct?

It's best to use v2.0-stable branch (which produces point releases for v2.0) or master, which is nearing becoming v2.1.

-Andy

>Is *2.0.0* is the latest stable release? I am going to check my logic
>and
>will try to change it to make similar to test-client.c and will update
>how
>it goes.
>
>Thank you.
>
>On Sat, Jul 16, 2016 at 4:53 PM, Andy Green <andy at warmcat.com> wrote:
>
>>
>>
>> On July 16, 2016 7:03:54 PM GMT+08:00, Harshad Italiya <
>> harshaditaliya at gmail.com> wrote:
>> >Hello,
>> >
>> >I am using libwebsocket and I have created client application. I am
>> >using
>> >GSM modem in my system for internet connectivity and because of that
>> >there
>> >are many times I am loosing GPRS and I have implemented my
>application
>> >in
>> >such a way so if there is GPRS lost then I am closing the connection
>> >by *"lws_context_destroy(lws_context)"
>>
>> No... that destroys the whole context.
>>
>> You'd do that when your app was closing.
>>
>> >*this can also be in case when there is something wrong between
>client
>> >and
>> >server custom protocol communication missing.
>> >
>> >I have seen when I am closing connection when GPRS is lost and then
>> >it's
>> >back but not able to create a connection with server. While if I
>> >restart
>> >application then it gets connect fine.
>> >
>> >Is wait required after *lws_context_destroy* function call and
>before
>> >calling *lws_client_connect function*.
>>
>> No... closing a connection is a different animal.
>>
>> create context {
>>
>>   connect and close connections as many times as you like
>>
>> } destroy context
>> exit program
>>
>>
>> There are two valid ways to close client connections... return
>nonzero
>> from most callbacks, or set the timeout on the wsi to, eg, -1.
>>
>> More importantly look at the test client in
>./test-server/test-client.c
>> and follow how that works, if you did that you would see destroying
>the
>> context happens when it exits, although it closes and creates
>connections
>> many times (eg mirror connections last for a random 'lifetime' and
>then
>> reconnect).
>>
>> -Andy
>>
>> >Regards,
>> >
>> >
>>
>>------------------------------------------------------------------------
>> >
>> >_______________________________________________
>> >Libwebsockets mailing list
>> >Libwebsockets at ml.libwebsockets.org
>> >http://libwebsockets.org/mailman/listinfo/libwebsockets
>>
>>




More information about the Libwebsockets mailing list