In the previous version of libwebsockets, the open API had the libwebsocket_close_and_free_session function.
The previous test code is used to close connections, for example.
if (mirror_lifetime == 0) { fprintf(stderr, "closing mirror session\n"); libwebsocket_close_and_free_session(context, wsi_mirror, LWS_CLOSE_STATUS_GOINGAWAY);
but the new test code uses the return -1 approach, so I assume the supposed graceful approach
mirror_lifetime--; if (!mirror_lifetime) { fprintf(stderr, "closing mirror session\n"); return -1; }
The function still exists in the library code, but now it is in the private-libwebsocket.h . I'm not sure if you can access it (or access it) from there in your code. If you could, this would be the perfect API for you, as you can close other connections if you have a struct libwebsocket *wsi .
source share