websockets (version 1.1.7)

websocket_broadcast: websocket_broadcast

Description

Write data to all websocket clients associated with one websocket server.

Usage

websocket_broadcast(DATA, server)

Arguments

DATA

A character string or RAW vector to broadcast.

server

A websocket server environment returned by create_server.

Value

The number of bytes sent is returned when successful (otherwise an error is thrown).

Details

The HTML 5 Websocket API emulates a connection-oriented socket without a true broadcast capability. The websocket_broadcast function emulates a broadcast by sending the DATA payload to each connected client in a loop.

Examples

Run this code
# NOT RUN {
##
# }

Run the code above in your browser using DataLab