Class wsc.MessageAlertPackage
A package that enables message notification applications.
An instance can be created by a new wsc.MessageAlertPackage session,
to receive message waiting alerts from a message server.
The alerts can indicate pending voice mails, fax messages and others.
The associated session invokes this package to handle and deliver notification messages.
Constructor Attributes | Constructor Name and Description |
---|---|
wsc.MessageAlertPackage(session)
|
Method Attributes | Method Name and Description |
---|---|
createNewSubscription(target, subscriber, onSuccess, onError, onNotification, onEnd, extHeaders)
Creates and starts a new Subscription object.
|
Event Attributes | Event Name and Description |
---|---|
onMessage(msg)
For extensibility - Processes a received message.
|
|
onRehydration(rehydratedData)
For extensibility - Handles the rehydration data.
|
|
onResurrect(rehydratedSubscription)
Event handler.
|
Class Detail
wsc.MessageAlertPackage(session)
subscribeHandler = new wsc.MessageAlertPackage(wscSession);
- Parameters:
- {wsc.Session} session
- Associated session
- Returns:
- MessageAlertPackage
Method Detail
createNewSubscription(target, subscriber, onSuccess, onError, onNotification, onEnd, extHeaders)
Creates and starts a new Subscription object.
subscription = subscribeHandler.createNewSubscription( target,subscriber,onSubscribeSuccess,onSubscribeError,onNotification,onEnd);
- Parameters:
- {String} target
- The service target of the new subscription
- {String} subscriber
- The user identity of the subscriber
- onSuccess
- Event handler which is called when the subscription succeeds. The parameter is the target of the subscription.
- onError
- Event handler called when an error occurs during subscribe/notify. The parameter is errorCode.
- onNotification
- Event handler called when a notification message is received. The parameter is a Notification object.
- onEnd
- Event handler called when an end message is received during subscribe/notify
- {Object} extHeaders
- extension headers. If provided, they are inserted into the JSON message.
For example, the following extHeaders,{'customerKey1':'value1','customerKey2':'value2'}
will be converted into the following JSON:
{ "control" : {}, "header" : {...,'customerKey1':'value1','customerKey2':'value2'}, "payload" : {}}
- Returns:
- a Subscription object
Event Detail
onMessage(msg)
For extensibility - Processes a received message.
This function handles MessageAlertPackage messages, and lets you process Subscription object operations as required.
This is an SPI function which can be overridden when the MessageAlertPackage object exposed by the WebRTC Session Controller JavaScript API is extended.
This function handles MessageAlertPackage messages, and lets you process Subscription object operations as required.
This is an SPI function which can be overridden when the MessageAlertPackage object exposed by the WebRTC Session Controller JavaScript API is extended.
- Parameters:
- {wsc.Message} msg
- Message received
onRehydration(rehydratedData)
For extensibility - Handles the rehydration data.
This is an SPI function meant to be used when extending the objects exposed by the WebRTC Session Controller JavaScript API.
When a web page is reloaded, an application can use this method to rehydrate related session object,
including the object created by MessageAlertPackage - Subscription.
This is an SPI function meant to be used when extending the objects exposed by the WebRTC Session Controller JavaScript API.
When a web page is reloaded, an application can use this method to rehydrate related session object,
including the object created by MessageAlertPackage - Subscription.
- Parameters:
- rehydratedData
- the rehydrated data
onResurrect(rehydratedSubscription)
Event handler. If an application would like to reload the session,
this function is called when the page is reloaded to restore a Subscription.
When the function is invoked, a wsc.Subscription object is provided as a parameter.
subscribeHandler = new wsc.MessageAlertPackage(wscSession); if (subscribeHandler) { subscribeHandler.onResurrect = onResurrect; } function onResurrect(rehydratedSubscription) { // reset related callback functions subscription = rehydratedSubscription; subscription.onSuccess = onSubscribeSuccess; subscription.onError = onSubscribeError; subscription.onNotification = onNotification; subscription.onShutdown = onShutdown; // initialize other part, such as page ... }
- Parameters:
- {wsc.Subscription} rehydratedSubscription
- is an instance of a Subscription object which is rehydrated.