[Libwebsockets] How to close the ws connection properly
kunzhao77 at gmail.com
Fri Jul 20 15:42:05 CEST 2018
This question is very prompt. I'm just about to ask how to close a client
WebSocket connection. Is this the same way to close a client connection? I
have one context serving multiple client connections.
On Wed, Jul 18, 2018 at 4:52 PM Brice Hamon <brice at ydotm.com> wrote:
> 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
>> Best Wishes,
>> Libwebsockets mailing list
>> Libwebsockets at ml.libwebsockets.org
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libwebsockets