MULTISCREEN.CHANNEL
This class provides basic functions to consist Smart View contents. It supports to connect and disconnect to each devices for communication and send a message from one of connected devices to the others.
Add the following line for multiscreen.Channel class into a html file your own : <script type="text/javascript" src="$MANAGER_WIDGET/Common/webapi/1.0/webapis.js"></script> |
You can declare multiscreen.Channel class like this : ex) var multiscreenChannel = webapis.multiscreen.Channel; |
Methods
connect | ||
Description | ||
Connects to the channel | ||
Parameters | ■ attributes - Object - Any attributes you want to associate with the client (ie.) {name:"FooBar"} ■ callback - Function - The callback handler [callback parameter] * error - An error instance if one occurred during the async call * client - channel client | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | . | |
Example | ||
var hostChannel = webapis.multiscreen.Channel; hostChannel.connect(attributes, function (error,client) { }); |
disconnect | ||
Description | ||
Disconnects from the channel | ||
Parameters | ■callback - Function - The callback handler [callback parameter] * error - An error instance if an occurred during | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | . | |
Example | ||
var hostChannel = webapis.multiscreen.Channel; hostChannel.disconnect(function (error){}); |
broadcast | ||
Description | ||
Sends a message to all clients connected to the channel excluding the sender | ||
Parameters | ■message - String - The message to send | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | . | |
Example | ||
var hostChannel = webapis.multiscreen.Channel; hostchannel.broadcast("message"); |
send | ||
Description | ||
Sends a message to the specified target or targets. | ||
Parameters | ■message - String - The message to send ■target - String or Array - The target recipient of the message | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | . | |
Example | ||
var hostChannel = webapis.multiscreen.Channel; hostChannel.send(message, clientId); |