[Libwebsockets] ws client initiated close frame?

Dave Horton daveh at beachdognet.com
Tue Mar 5 21:51:16 CET 2019


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…

Dave


More information about the Libwebsockets mailing list