[Libwebsockets] How to close the ws connection properly
brice at ydotm.com
Wed Jul 18 23:51:01 CEST 2018
Yes that is correct.
Trigger a writeable event on your wsi, then on write return -1.
You are doing it correctly.
On Wed, Jul 18, 2018 at 4:04 AM, Chropin Hu <chropinhu at gmail.com> wrote:
> Dear All,
> How to close the ws connection from the server side?
> currently, I just call the following funtion at stand alone thread,
> (unsigned char *)"seeya", 5);
> then, handle LWS_CALLBACK_SERVER_WRITEABLE msg like this,
> case LWS_CALLBACK_SERVER_WRITEABLE:
> case LWS_CALLBACK_HTTP_WRITEABLE:
> if (lws_get_close_length(wsi))
> return -1;
> It` seems work well, the connection closed. but I am not sure for
> are there other ways to close the ws connection from the server side?
> Best Wishes,
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libwebsockets