goog.messaging.MessageChannel
Interfacegoog.messaging.MessageChannel()
unhandled information:
type
'interface'
.connect(opt_connectCb)
Initiates the channel connection. When this method is called, all the information needed to connect the channel has to be available. Implementers should only require this method to be called if the channel needs to be configured in some way between when it's created and when it becomes active. Otherwise, the channel should be immediately active and this method should do nothing but immediately call opt_connectCb.
opt_connectCb
{Function
=}
.isConnected()
Gets whether the channel is connected. If {@link #connect} is not required for this class, this should always return true. Otherwise, this should return true by the time the callback passed to {@link #connect} has been called and always after that.
boolean
}
.registerDefaultService(callback)
Registers a service to be called when a message is received that doesn't match any other services.
callback
{function
(string
, (string
|!Object
))}
.registerService(serviceName, callback, opt_objectPayload)
Registers a service to be called when a message is received. Implementers shouldn't impose any restrictions on the service names that may be registered. If some services are needed as control codes, {@link goog.messaging.MultiMessageChannel} can be used to safely split the channel into "public" and "control" virtual channels.
serviceName
{string
}
callback
{function
((string
|!Object
))}
opt_objectPayload
{boolean
=}
.send(serviceName, payload)
Sends a message over the channel.
serviceName
{string
}
payload
{string
|!Object
}