[Libwebsockets] ws client initiated close frame?
daveh at beachdognet.com
Tue Mar 5 22:16:35 CET 2019
OK, scratch that. My problem was that I wasn’t calling lws_close_reason() before returning -1.
On Mar 5, 2019, at 3:51 PM, Dave Horton <daveh at beachdognet.com> wrote:
I have an websocket client that is working fine, however currently when I close the websocket from the client side the ws server (non-lws) generates an exception (err: 1006).
I am closing the socket simply by returning -1 from my LWS_CALLBACK_CLIENT_WRITEABLE, which I think per the documentation is the recommended way.
When I take a network capture I see that this closes the TCP socket. Again, fine, but from reading the spec (https://tools.ietf.org/html/rfc6455#section-5.5.1),
I am wondering if the issue is that the server is expecting me to send a CLOSE frame.
Is there a way for my lws client to send a CLOSE frame as part of shutdown?
The spec further seems to say that the connection SHOULD be first closed from the server (https://tools.ietf.org/html/rfc6455#section-7.1.1).
I’m just wondering if I am doing things correctly with regard to the scenario of web socket client-initiated close…
More information about the Libwebsockets