Notification Service
SDK provide APIs to subscribe for push notification using APNS,FCM or XMPP notification over websocket using SDK callback. Before invoking notification APIs, make sure you have set the mandatory configuration as mentioned here.
XMPP Notification
Both notify
and cancel
XMPP notifications by default will be received through SDK onNotification callback without any need for subscription.
APNS Notification
Below APIs are for subscribing/unsubscribing the PUSH notification to notify
new incoming call. All cancel
notification by default will be received through SDK onNotification callback without any need for subscription.
Create Subscriptions
This API will register the subscriber for the PUSH notification and create subscription for topic provided. createSubscriptions API return a promise.
If subscription is successful,Response will have an array of objects which contains subscriberId,protocol and array of topics,for each unique subscriberID created.
Otherwise error JSON with code and reason for error.
var subscriptionArray = [];
var subscriptionobj = {"protocol" : "<Protocoltype>",// protocol for subcription of notificiation i.e., apns or fcm
"deviceToken" : "<deviceToken>",// required when protocol is apns or fcm
"apntopic" : "\(Bundle.main.bundleIdentifier!).voip", // required when protocol is apns
"topic" : "federation/pstn/<Routing Id>"};
subscriptionArray.push(subscriptionobj);
var appDomain = "uc-prod.comcast.com" // app domain
Rtc555Ntm.createSubscriptions(subscriptionArray,appDomain)
.then(function (response) {
for (var i in response){
console.log("subscription id ::",response[i].subscriberId);
console.log("protocol ::",response[i].protocol);
console.log("topics ::",response[i].topics);
}
// handle success
})
.catch(function (error) {
// handle error
console.log(error.code);
console.log(error.reason);
})
Parameters
Property | Type | Description |
---|---|---|
subscriptions | array | Contains array of subscription object. Subscription contains protocol,Device token(in case of apns and fcm), apntopic(in case of apns protocol), topic |
appDomain | string | application domain |
Below is the subscription object need to be populated:
Property | Type | Description |
---|---|---|
protocol | string | value like "fcm" or "apns" |
deviceToken | string | device token in case of apns and fcm protocol |
apnTopic | string | contains topic appended to application bundle identifier |
topic | string | pass "federation/pstn/ |
Delete Subscription
Users need to pass subscriberId, topic, app domain for deleting subscription. deleteSubscription API return a promise.
If subscription is deleted successfully,topic and subscriberId of deleted subscription will be returned as response,
Otherwise error JSON with code and reason for error.
Rtc555Ntm.deleteSubscription(subscriberId, topic,appDomain)
.then(function (response) {
// handle success
console.log(response.topic);
console.log(response.subscriberId);
})
.catch(function (error) {
// handle error
console.log(error.code);
console.log(error.reason);
})
Parameters
Property | Type | Description |
---|---|---|
subscriberId | string | subscriber id |
topic | string | value like "pstn or "video" |
appDomain | string | application domain |
Delete All Subscriptions
Users need to pass subscriberId for deleting all subscription. deleteAllSubscriptions API return a promise.
If subscriptions is deleted successfully,deleted subscriberId will be returned as response
Otherwise error JSON with code and reason for error.
Rtc555Ntm.deleteAllSubscriptions(subscriberId)
.then(function (subscriberId) {
// handle success
console.log(subscriberId);
})
.catch(function (error) {
// handle error
console.log(error.code);
console.log(error.reason);
});
Parameters
Property | Type | Description |
---|---|---|
subscriberId | string | subscriber id |