wsServer icon indicating copy to clipboard operation
wsServer copied to clipboard

[feature] Shutting down websocket

Open habi498 opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. I was trying to integrate websocket server inside squirrel via its api. I created function StartWebsocketServer(host, port, timeout); Then i see that users cannot close it.

Describe the solution you'd like I like to have a function ws_shutdown() which will shut everything down, stop the threads, close the sockets.

Describe alternatives you've considered I considered alternative as manually close port on ws.c

Additional context

habi498 avatar Sep 08 '24 15:09 habi498

Hi @habi498, This is a long standing feature requested for a few years, since issue #31 at least.

I haven't implemented it yet because I'm not sure on how to do it: whether I should gracefully close each client connection, or if it's 'ok' to just abruptly close connections. Since wsServer is advertised as RFC 6455-compliant, these are questions that concern me a bit about how to approach this.

I still want to implement it, and I want to see how other big and reference libraries do it, if most of them just abruptly close the connections, I won't have a problem doing that either =).

Theldus avatar Sep 11 '24 01:09 Theldus