[Libwebsockets] Closing client connection

techi eth techieth at gmail.com
Fri Jul 15 05:25:57 CEST 2016


I agree with you point that other side is out of lws however server using
lws need's to clean himself if he know this kind of stale connection exists.

One solution you have pointed out by sending some data & that will fail on
TCP & lws will give WSI Destroy.

lws have lot of developer friendly API so that they needn't to add this
kind of complex logic & i think adding this will add feature to lws.

If you can give me hint in lws code then i can check for adding & update
patch to you.

On Wed, Jul 13, 2016 at 5:47 PM, Andy Green <andy at warmcat.com> wrote:

>
>
> 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
> >connection
> >API so that server application can decide if they want to really close
> >connection.
>
> When we say 'better' what are we comparing it with?
>
> >I was just looking Client/Server support from .Net framework & found
> >they
> >will provide close interface to handle this cases.
>
> Handle exactly what case?  What is getting fixed?
>
> -Andy
>
> >
> >
> >
> >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
> >closing
> >> > but some cases where server needs to close client connection
> >without
> >> > callback.
> >>
> >> Can you explain more about those cases?
> >>
> >> It's that lws is just doing serving only, and decides he must drop
> >what
> >> was an incoming client connection?  All client connections?
> >>
> >> -Andy
> >>
> >> >
> >> > _______________________________________________
> >> > Libwebsockets mailing list
> >> > Libwebsockets at ml.libwebsockets.org
> >> > http://libwebsockets.org/mailman/listinfo/libwebsockets
> >>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20160715/6a919654/attachment-0001.html>


More information about the Libwebsockets mailing list