[Libwebsockets] Closing client connection

Andy Green andy at warmcat.com
Wed Jul 13 14:17:43 CEST 2016

On July 13, 2016 1:17:29 AM GMT+08:00, techi eth <techieth at gmail.com> wrote:
>I am facing issue when client close without informing server (Power
>Off/Application Crash/Network Down).In that case server side still have
>that connection & i think that connection get broken on ping/pong time.

Right, but that is a reality outside of lws.

If there is no traffic after the connection was established, and one side is gone silently, the other side has no reason to think he's not still there, but silent.

You send the other guy something periodically to confirm he's silent because he has nothing to say, not that he's dead / gone.  Just sending him something will create the expectation for tcp ACKs coming back.

>What i am thinking it will be better solution if we have close
>API so that server application can decide if they want to really close

When we say 'better' what are we comparing it with?

>I was just looking Client/Server support from .Net framework & found
>will provide close interface to handle this cases.

Handle exactly what case?  What is getting fixed?


>On Tue, Jul 12, 2016 at 12:26 PM, Andy Green <andy at warmcat.com> wrote:
>> On Tue, 2016-07-12 at 11:27 +0530, techi eth wrote:
>> > Is their any API for closing client connection by server ?
>> >
>> > As of now i am returning non negative value from callback for
>> > but some cases where server needs to close client connection
>> > callback.
>> Can you explain more about those cases?
>> It's that lws is just doing serving only, and decides he must drop
>> was an incoming client connection?  All client connections?
>> -Andy
>> >
>> > _______________________________________________
>> > Libwebsockets mailing list
>> > Libwebsockets at ml.libwebsockets.org
>> > http://libwebsockets.org/mailman/listinfo/libwebsockets

More information about the Libwebsockets mailing list