Learn R Programming

websockets (version 1.1.7)

websocket_close: Close a websocket connection.

Description

Close a websocket server or client connection.

Usage

websocket_close(connection)

Arguments

connection

A websocket client or server. See the details section for more information.

Value

An integer value returned by the underlying TCP socket close function which may vary in interpretation from system to system.

Details

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]].

See Also

websocket_write