Constructor

CastChannel

new CastChannel(castMessageBus, senderId)

Parameter

castMessageBus

cast.receiver.CastMessageBus

The underlying namespace message bus for this channel.

Value must not be null.

senderId

string

The ID of the sender.

See also
cast.receiver.CastMessageBus

Class

Enumeration

EventType

static

string

System events dispatched by cast.receiver.CastChannel.

Value

MESSAGE

Fired when there is a new message.

CLOSE

Fired when the sender associated with this cast channel has disconnected.

Properties

EventType

static

string

System events dispatched by cast.receiver.CastChannel.

Value

MESSAGE

Fired when there is a new message.

CLOSE

Fired when the sender associated with this cast channel has disconnected.

onClose

nullable function(non-null cast.receiver.CastChannel.Event)

Event handler for {code cast.receiver.CastChannel} close event. This API is provided for convenience, applications can as well add event listeners to the CastChannel object ('close' event) as CastChannel is an EventTarget.

onMessage

nullable function(non-null cast.receiver.CastChannel.Event)

Event handler for cast.receiver.CastMessageBus message event. This API is provided for convenience, applications can as well add event listeners to the CastChannel object ('message' event) as CastChannel is an EventTarget.

Methods

getNamespace

getNamespace() returns string

Returns

string The namespace for this CastChannel.

getSenderId

getSenderId() returns string

Returns

string The senderId for this CastChannel.

send

send(message)

Sends a message to the sender associated with this CastChannel.

Parameter

message

any type

The message.

Value must not be null.

Throws

Error If there was an error preparing the message.