↳ Messaging

AirConsole

new AirConsole(opts) → {AirConsoleObject}

Your gateway object to AirConsole. There are getter and setter functions for all properties. Do not access properties of this object directly.
Parameters:
Name Type Description
opts AirConsole~Config Constructor config, see bellow.
Source:
Returns:
The AirConsole object.
Type
AirConsoleObject

Methods

broadcast(data)

Sends a message to all connected devices.
Parameters:
Name Type Description
data
Source:

message(device_id, data)

Sends a message to another device.
Parameters:
Name Type Description
device_id number | undefined The device ID to send the message to. If "device_id" is undefined, the message is sent to all devices (except this one).
data
Source:

(abstract) onMessage(device_id, data)

Gets called when a message is received from another device that called message() or broadcast(). If you dont want to parse messages yourself and prefer an event driven approach, @see http://github.com/AirConsole/airconsole-events/
Parameters:
Name Type Description
device_id number The device ID that sent the message.
data serializable The data that was sent.
Source: