Socketio.broadcast()

Broadcast a message to all connected sockets in the specified room.

Note that this machine does not wait for any kind of acknowledgement of message delivery, so it is immediate/synchronous.

Usage

Hover over inputs/exits for more info.

var Socketio = require('machinepack-sockets');


// Broadcast a message to all connected sockets in the specified room.

Socketio.broadcast({

eventName: 'news',

roomName: 'myChatRoom',

data: '*',

}).execSync();

Inputs

eventName required

The name (aka "event name") to use for the message (just an arbitrary label).

'news'
roomName required

The name of the room where this message will be broadcasted.

'myChatRoom'
data

Data to send with the message.

'*'

Exits

error

An unexpected error occurred.

success

OK.