websockets (version 1.1.7)

websocket_write: websocket_write

Description

Write data to a websocket connection.

Usage

websocket_write(DATA, WS)

Arguments

DATA

A character string or RAW vector to write.

WS

A websocket client from a websocket server environment or a callback function. See the 'details' section below for more information.

Value

The number of bytes sent or an error. A returned value of -1 indicates that the websocket client socket should be closed.

Details

The WS argument must be a websocket client which is represented as a list. All connected clients are stored in the environment associated with a webserver in the client_sockets list. Because each connected client is itself a list, 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

setCallback

Examples

Run this code
# NOT RUN {
##
# }

Run the code above in your browser using DataLab