[Libwebsockets] lws_close_reason api uses

Andy Green andy at warmcat.com
Thu Jun 23 09:05:05 CEST 2016

On 06/23/2016 01:44 PM, techi eth wrote:
> I am trying to use lws_close_reason for informing client to close
> session but not receiving any info on client receive callback ?
> am i using right api from libwebsocket for closing client ?

lws_close_reason() sets the reason that will be given when you actually 
do the close, it does not close the connection itself.

You should return -1 from the callback to actually close, after setting 
the close reason.

This is part of the lws server test page


or run your own test server with libwebsockets-test-server and send your 
browser to http://localhost:7681

You can confirm it yourself on the Close Testing page.


> Thanks
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> http://libwebsockets.org/mailman/listinfo/libwebsockets

More information about the Libwebsockets mailing list