Write data to all websocket clients associated with one websocket server.
写数据到所有的WebSocket客户端与一个WebSocket服务器。
用法----------Usage----------
websocket_broadcast(DATA, server)
参数----------Arguments----------
参数:DATA
A character string or RAW vector to broadcast.
一个的字符串或RAW矢量广播。
参数:server
A websocket server environment returned by create_server.
返回一个WebSocket服务器环境create_server。
Details
详细信息----------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.
HTML 5 WebSocket的API模拟一个面向连接的插座上没有一个真正的广播能力。 websocket_broadcast函数在一个循环中,每个连接的客户端发送数据的有效载荷模拟广播。
值----------Value----------
The number of bytes sent is returned when successful (otherwise an error is thrown).
成功时,返回发送的字节数(否则抛出一个错误)。