Close a websocket server or client connection.
websocket_close(connection)
A websocket client or server. See the details section for more information.
An integer value returned by the underlying TCP socket close function which may vary in interpretation from system to system.
Use websocket_close
to cleanly shut down a websocket server or client
connection.
If the connection
is a websocket server, all associated client connections
will also be closed.
Connected clients are stored in the environment associated with a websocket
server in the client_sockets
list. Because each connected client is
itself an environment, be careful to access a single client element, for
example with the '[[' indexing operator, shown here accessing the first client
socket: WS$client_sockets[[1]]
.