Notification Service
SDK provide APIs to subscribe for push notification using APNS or XMPP notification over websocket using SDK callback. Before invoking notification APIs, make sure you have initialized the SDK and 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. Implement Rtc555NtmDelegate protocol and pass the delegate to get subscription Id or error report during subscription.
Rtc555Ntm.createSubscriptions(subscriptions: buildSubscriptions(), appDomain: appDomain, rtcNtmDelegate: self)
//build Subscriptions
private func buildSubscriptions() -> Array<Subscription> {
var subscriptions: [Subscription] = []
var subtopic : Subscription = Subscription()
let apnsTopic = "\(Bundle.main.bundleIdentifier!).voip"
subtopic.apnTopic = apnsTopic
subtopic.deviceToken = <deviceToken> // APNS device token
subtopic.protocolType = "apns"
subtopic.topic = "federation/pstn/<Routing Id>"
subscriptions.append(subtopic)
return subscriptions
}
Parameters | Type | Description |
---|---|---|
subscriptions | array | Contains array of subscription object. Subscription contains Device token, apntopic, protocol type, topic |
appDomain | string | app domain |
rtcNtmDelegate | object | Rtc555NtmDelegate |
Below is the Subscription object that needs to be built:
Parameters | Type | Description |
---|---|---|
deviceToken | string | APNS device token |
apnTopic | string | contains topic appended to application bundle identifier |
protocolType | string | pass "apns" |
topic | string | pass "federation/pstn/ |
Delete Subscription
Users need to pass subscriberId, topic, app domain for deleting subscription. Implement Rtc555NtmDelegate protocol and pass the delegate to get status or error report during deletion.
Rtc555Ntm.deleteSubscription(subscriberId :subscriberId,topic :topic,appdomain :appdomain,rtcNtmDelegate :self)
Parameters | Type | Description |
---|---|---|
subscriberId | string | subscriber Id received from subscription callback |
topic | string | subscribed topic |
appDomain | string | app domain |
rtcNtmDelegate | object | Rtc555NtmDelegate |
Delete All Subscriptions
Users need to pass subscriberId for deleting all subscription. Implement Rtc555NtmDelegate protocol and pass the delegate to get status or error report during deletion.
Rtc555Ntm.deleteAllSubscriptions(subscriberId: subscriberId, rtcNtmDelegate: self)
Parameters | Type | Description |
---|---|---|
subscriberId | string | subscriber Id received from subscription callback |
rtcNtmDelegate | object | Rtc555NtmDelegate |
APNS Notification Delegates
onSubscriptionSuccess
This callback gets invoked when we receive success status for create subscription API.
func onSubscriptionSuccess(subscriptions subscriptionInfo: [Any]) {
}
Parameters | Type | Description |
---|---|---|
subscriptionInfo | dictionary | Contains subscriberId , topic, appdomain |
Below is the subscriptionInfo object details:
Parameters | Type | Description |
---|---|---|
subscriberId | string | subscriber Id |
topic | array | Array of subscribed topics |
appdomain | string | app domain |
onSubscriptionFailure
This callback gets invoked when we receive error status for create subscription API.
func onSubscriptionFailure(error errorInfo: Error) {
}
Parameters | Description |
---|---|
errorInfo | error object consists of error code and error message |
onSubscriptionDeleted
This callback gets invoked when we receive success status for delete subscription API.
func onSubscriptionDeleted(topic Topic: NSString, subscriberId subscriberid: NSString) {
}
Parameters | Type | Description |
---|---|---|
subscriberId | string | subscriber Id |
topic | string | subscribed topic |
onSubscriptionDeletionFailure
This callback gets invoked when we receive error status for delete / delete all subscription API.
func onSubscriptionDeletionFailure(error errorInfo: Error) {
}
Parameters | Description |
---|---|
errorInfo | error object consists of error code and error message |
onSubscriberDeleted
This callback gets invoked when we receive success status for delete all subscription API.
func onSubscriberDeleted(subscriberId subscriberid: NSString) {
}
Parameters | Description |
---|---|
subscriberId | subscriber Id |