3

I am using libwebsockets C library for writing a websocket server. According to library documentation, it is mentioned that to close websocket connection from server side we need return -1 in callback. When I did that websocket connection is getting closed, but it is not sending any reason.

I want to send Normal Close as the reason from closing websocket connection. Is there any way to achive this libwebsockets. I have seen libwebsockets library has "enum lws_close_status" but there are no api's to use that one.

Suresh
  • 253
  • 2
  • 4
  • 13

1 Answers1

0

As of now there is now API to send a close reason to client.

Find below github issue for more info.

https://github.com/warmcat/libwebsockets/issues/196

Edit: This issue has been resolved. And now new api is provided to set the close reason. Commit https://github.com/warmcat/libwebsockets/commit/1fb95e8084bc7b27e72bf199ba422efdfbee360b

It might come in libwebsockets 1.7 release.

Suresh
  • 253
  • 2
  • 4
  • 13