Options
All
  • Public
  • Public/Protected
  • All
Menu

External module push

Index

Type aliases

ProviderType

ProviderType: "GCM" | "APNS" | "MCAP" | "WNS" | "PAP"

communication provider used to transport push messages to a push Device.

This models the Java enum com.mwaysolutions.gofer2.push.domain.ProviderType.

PushCallback

PushCallback: function

receives incoming push notification messages once registered using listenPushNotification().

For each incoming push notification message the callback is executed performing some app-specific action. The caller will wait until the optionally returned promise gets resolved, before signalling the operating system the message got processed completely.

Notice, the next push notification message may be passed to the callback even before the returned promise completed. This is, the optional promise returned just controls when the end of processing gets signalled to the operating system, but not when the app is ready.

Also, care must be taken as processing of a push notification message must not exceed more than 30s according to push plugin documentation at https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/PAYLOAD.md. For that reason it makes no sense to display some blocking user interface here!

If during any of these steps some error is detected, the callback is executed. This holds even when during processing of a push notification message the callback itself signalled an error. In this case, both parameters are supplied.

Type declaration

PushMessage

PushMessage: NotificationEventResponse

an incoming push notification message.

State

State: "UNUSED" | "QUEUED" | "RUNNING" | "FINISHED"

transmission status of a push Job.

This models the Java enum com.mwaysolutions.gofer2.push.domain.State.

Functions

configurePushDevice

  • authorizes current Relution server logged onto to send push notifications by transmitting the registration token.

    Parameters

    Returns Promise<Device>

fetchPushNotification

  • fetchPushNotification(uuidOrMessage: string | Job): Promise<Job>
  • gets push notification status.

    The implementation relies on backend code generated by CLI which uses the server-side PushService to query for Job by uuid.

    Parameters

    • uuidOrMessage: string | Job

      to query.

    Returns Promise<Job>

    promise of async execution resolving to push Job information.

listenPushNotification

  • listenPushNotification(callback?: PushCallback): Promise<RegistrationEventResponse>
  • installs a callback for receiving push notification messages, and registers the device with the 3rd party push service provider.

    Usually push configuration is provided to init() and a call to this method is chained passing the sink callback. Application using an explicit login then call configurePushDevice() as part of the LogonCallback while anonymous applications call the latter directly.

    In general it is not wise to unregister from push messages. However, this functionality is available by passing null as callback.

    Parameters

    • Default value callback: PushCallback = defaultPushCallback

      to install, or explicitly null to unregister.

    Returns Promise<RegistrationEventResponse>

    promise of registration, for informal purposes.

postPushNotification

  • postPushNotification(message: Job): Promise<string[]>
  • posts push notification(s).

    Usually the server sends push notifications on its own behalf. However, this method may be used by the client app itself to send push notifications either to other clients, or to itself which can be used to test connectivity.

    The implementation relies on backend code generated by CLI which forwards the body JSON to the server-side implementation of this method.

    Parameters

    • message: Job

      to deliver.

    Returns Promise<string[]>

    promise of async execution resolving to UUIDs of jobs in asynchronous delivery, empty when no apps or devices got selected by the message criteria or null when no target apps or devices exist at all.

pushDeviceFilterByUsers

  • pushDeviceFilterByUsers(...users: User | string): Filter
  • creates a device filter for the user attribute of push devices matching any of a given set of users.

    Parameters

    • Rest ...users: User | string

    Returns Filter

    device filter matching devices of given users.

registerPushDevice

  • registers a target device with the current Relution server.

    The implementation relies on backend code generated by CLI. That code attempts fetching an existing device using the metadata information send as request body data. If it finds one, that device is updated. Otherwise a new device is created and stored in the database. The updated device registration record then is sent as response body data.

    internal

    SDK client code must call configurePushDevice() which obtains the token.

    Parameters

    Returns Promise<Device>

    promise of registered device.

Generated using TypeDoc