WCWebcom

class WCWebcom : WCQuery
  • Set up wake-up subscriptions from your mobile app code.

    Important Notes

    1.Mobile wake-up is a functionality provided by Apple for iOS (APNs). Flexible Datasync interconnects only with FCM. As FCM provides a relay service to APNs, APNs can also be used via Flexible Datasync and FCM. In order to use FCM (or APNs through the FCM relay), you need to configure a Google key in Flexible Datasync developer console.

    2.To get such a key, first, go to Firebase console and create a project, then generate and copy a server key in project settings / Cloud messaging.

    3.In addition, if you want to use APNs, you need to follow this procedure .

    4.path : you should precise your path where you need to subscribe example : path = childMain/childSecond/finalChild.

    Examples :

    wakeupSubscribe(deviceidToken: deviceidToken, tokenAuth: tokenAuth, path: path, mode: mode , completeCallback: { (data, error) in
        if ( error != nil ) {
           print(" WakeupSubscribe complete")
        }else {
           print(" WakeupSubscribe error")
        }
    })
    

    Declaration

    Swift

    @nonobjc
    public func wakeupSubscribe( deviceidToken deviceId : String , tokenAuth token : String , path pathChild : String , mode : String ,completeCallback:@escaping(_ res : [String:Any]? , _ error : Error?) -> Void)

    Parameters

    deviceidToken

    DeviceID of the mobile device (referred to as token in the official FCM API). You can get it using FCM API

    tokenAuth

    Name of the provider as described in the oAuth2 authentication Flexible Datasync documentation.

    path

    You choose the path of the data node in the Flexible Datasync database that may wake up your iOS app.

    mode

    { value , noData , childEvent }.

    completeCallback

    Block called once Wakeup subscribe is complete. On failure, return error object ( Error).

  • Remove wake-up subscriptions from your mobile app code.

    Important Notes

    1.Mobile wake-up is a functionality provided by Apple for iOS (APNs). Flexible Datasync interconnects only with FCM. As FCM provides a relay service to APNs, APNs can also be used via Flexible Datasync and FCM. In order to use FCM (or APNs through the FCM relay), you need to configure a Google key in Flexible Datasync developer console.

    2.To get such a key, first, go to Firebase console and create a project, then generate and copy a server key in project settings / Cloud messaging.

    3.In addition, if you want to use APNs, you need to follow this procedure .

    4.path : you should precise your path where you need to unsubscribe example : path = childMain/childSecond/finalChild.

    Examples :

    wakeupUnsubscribe(deviceidToken: deviceidToken, tokenAuth: tokenAuth, path: path, completeCallback: { (data, error) in
        if ( error != nil ) {
           print(" WakeupUnsubscribe complete")
        }else {
           print(" WakeupUnsubscribe error")
        }
    })
    

    Declaration

    Swift

    @nonobjc
    public func wakeupUnsubscribe( deviceidToken deviceId : String , tokenAuth token : String , path pathChild : String ,completeCallback:@escaping(_ res : [String:Any]? , _ error : Error?) -> Void )

    Parameters

    deviceidToken

    DeviceID of the mobile device (referred to as token in the official FCM API). You can get it using FCM API

    tokenAuth

    Name of the provider as described in the oAuth2 authentication Flexible Datasync documentation.

    path

    You choose the path of the data node in the Flexible Datasync database that may wake up your iOS app.

    completeCallback

    Block called once Wakeup unsubscribe is complete. On failure, return error object ( Error).

  • Retrieve data from your database with NotificationService Class .

    Important Notes

    • WebcomOnceExtensionNotif is a static function from WATManager class .

    • This function WebcomOnceExtensionNotif use only with NotificationService class to get data from your database .

    • Your extension has a limited amount of time (no more than 30 seconds) to modify the content and execute the contentHandler block that’s why your should use WebcomOnceExtensionNotifChat to get data from your database.

    Example :

    WebcomOnceExtensionNotif(dataBaseName: "DataBaseName", path: "Path of your Data", token: "***") { (data) in
        do{
            let resultObject = try JSONSerialization.jsonObject(with: data, options: [])
            self.bestAttemptContent?.title = "JSON OBJECT"
            self.bestAttemptContent?.body = "\(resultObject)"
            self.contentHandler!(self.bestAttemptContent!)
        }catch{
    
        }
    }
    

    Declaration

    Swift

    @nonobjc
    public static func WebcomOnceExtensionNotif(dataBaseName : String , path : String , token : String? , completion: @escaping ((_ dataObject : Data) -> Void))

    Parameters

    dataBaseName

    Name of your databse.

    Path

    Path complete for retrieve your data.

    Token

    Token of the current user.