<div dir="ltr">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.<div><br></div><div>Thanks,</div><div>Kun</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jul 18, 2018 at 4:52 PM Brice Hamon <<a href="mailto:brice@ydotm.com">brice@ydotm.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:x-small">Yes that is correct.</div><div class="gmail_default" style="font-size:x-small">Trigger a writeable event on your wsi, then on write return -1.<br></div><div class="gmail_default" style="font-size:x-small">You are doing it correctly.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 18, 2018 at 4:04 AM, Chropin Hu <span dir="ltr"><<a href="mailto:chropinhu@gmail.com" target="_blank">chropinhu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear All,<div>       How to close the ws connection from the server side?</div><div>       currently, I just call the following funtion at stand alone thread,</div><div><font color="#0000ff">                   lws_close_reason(g_wsi_test_close, LWS_CLOSE_STATUS_NORMAL,</font></div><div><font color="#0000ff"><span style="white-space:pre-wrap">                                  </span> (unsigned char *)"seeya", 5);</font></div><div><font color="#0000ff"><span style="white-space:pre-wrap">              </span>   lws_callback_on_writable(g_wsi_test_close);</font></div><div><font color="#0000ff">       </font></div><div>        then, handle <span style="font-size:small;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">LWS_CALLBACK_SERVER_WRITEABLE msg like this,</span></div><div><div>               <font color="#0000ff">case LWS_CALLBACK_SERVER_WRITEABLE:</font></div><div><font color="#0000ff"><span style="white-space:pre-wrap">          </span>case LWS_CALLBACK_HTTP_WRITEABLE:</font></div><div><font color="#0000ff"><span style="white-space:pre-wrap">             </span>{</font></div><div><font color="#0000ff"><span style="white-space:pre-wrap">                     </span>if (lws_get_close_length(wsi))</font></div><div><font color="#0000ff"><span style="white-space:pre-wrap">                        </span>{</font></div><div><font color="#0000ff"><span style="white-space:pre-wrap">                             </span>return -1;</font></div><div><font color="#0000ff"><span style="white-space:pre-wrap">                    </span>}</font></div><div><font color="#0000ff"><span style="white-space:pre-wrap">             </span>}</font></div></div><div><font color="#0000ff">      </font><font color="#000000">It` seems work well,  the connection closed. but I am not sure for this.</font></div><div><font color="#000000">      are there other ways to close the ws connection from the server side?</font></div><div><font color="#000000"><br></font></div><div><font color="#000000">Best Wishes,</font></div><div><font color="#000000">Chropin.</font></div><div><font color="#000000">      </font></div></div>
<br>_______________________________________________<br>
Libwebsockets mailing list<br>
<a href="mailto:Libwebsockets@ml.libwebsockets.org" target="_blank">Libwebsockets@ml.libwebsockets.org</a><br>
<a href="https://libwebsockets.org/mailman/listinfo/libwebsockets" rel="noreferrer" target="_blank">https://libwebsockets.org/mailman/listinfo/libwebsockets</a><br>
<br></blockquote></div><br></div>
_______________________________________________<br>
Libwebsockets mailing list<br>
<a href="mailto:Libwebsockets@ml.libwebsockets.org" target="_blank">Libwebsockets@ml.libwebsockets.org</a><br>
<a href="https://libwebsockets.org/mailman/listinfo/libwebsockets" rel="noreferrer" target="_blank">https://libwebsockets.org/mailman/listinfo/libwebsockets</a><br>
</blockquote></div>