Class wsc.Subscription
Represents a subscription.
Constructor Attributes | Constructor Name and Description |
---|---|
An object of this class is created by wsc.MessageAlertPackage#createNewSubscription and returned.
|
Method Attributes | Method Name and Description |
---|---|
end(extHeaders)
Stops current subscription of message notifications.
|
|
isValid()
Checks whether the current subscription is active.
|
Event Attributes | Event Name and Description |
---|---|
onEnd()
Callback function to invoke when an end message for a subscription is received.
|
|
onNotification(notification)
Callback function to invoke when a Notify request message is received.
|
Class Detail
wsc.Subscription()
An object of this class is created by wsc.MessageAlertPackage#createNewSubscription and returned.
Method Detail
end(extHeaders)
Stops current subscription of message notifications.
- Parameters:
- {Object} extHeaders
- extension headers. If provided, they will be inserted into JSON message.
Example, An extHeaders in this format:{'customerKey1':'value1','customerKey2':'value2'}
will be converted to the following JSON:
{ "control" : {}, "header" : {...,'customerKey1':'value1','customerKey2':'value2'}, "payload" : {}}
{boolean}
isValid()
Checks whether the current subscription is active. If the current subscription is active,
it returns 'true'; otherwise it returns 'false'.
- Returns:
- {boolean}
Event Detail
onEnd()
Callback function to invoke when an end message for a subscription is received.
The application needs to configure this callback function.
The callback function is invoked without any parameters.
The callback function is invoked without any parameters.
function onEnd(){ //render the web page when the end message for current subscription is received var subscribeButton = document.getElementById("subscribeButton"); if(subscribeButton != null){ subscribeButton.disabled = false; } removeSubscriptionInfoElem(); }
onNotification(notification)
Callback function to invoke when a Notify request message is received.
The application needs to configure this callback function.
The callback function is invoked with a Notification wsc.Notification as a parameter.
The callback function is invoked with a Notification wsc.Notification as a parameter.
function onNotification(notification) { console.log("The sender of the notify is: "+notification.getSender()); console.log("The receiver of the notify is: "+notification.getReceiver()); }
- Parameters:
- {wsc.Notification} notification
- The wsc.Notification object which represents the received notification message.