Working with push requests

Before push requests can be generated, your consolidated database must contain the push request columns required for server-initiated
synchronization, and you must be able to obtain the values with a single database query. Push requests are generated automatically
when you provide a database query in the request_cursor event that selects push request columns. For more information about
push request requirements, see Push request requirements.

Assume that a remote device is identified on your MobiLink server as unique_device_ID, and your consolidated database contains
a table named PushRequest, which was created using the following SQL statement:

Using the above script to insert values into the PushRequest table does not generate a push request by itself. You must set
up a database query in the request_cursor event on the MobiLink server so that the inserted values can be selected and a push
request can be generated.

In this example, you can define the following SQL statement for the request_cursor event script on your MobiLink server:

SELECT poll_key, subject, content FROM PushRequest;

A push request is generated when the unique_device_ID device polls the server for push notifications and the request_cursor
event detects data in the PushRequest table. When sent to the device, the push notification subject is defined as synchronize, and the content is defined as ASAP.

Avoid using non-alphanumeric characters when setting this value. Braces, chevrons, double quotations, parenthesis, single
quotations, and square brackets are reserved for internal use, and should not be used in the subject column.

Content

VARCHAR

There are no limitations on the message content.

Address

VARCHAR

Only required when using gateways.

For UDP gateways, this value should be an IP address or hostname. Port number suffixes are supported in the following formats:

IP-address:port-number

hostname:port-number

For SMTP gateways, this value should be an email address.

For SYNC and device tracking gateways, this value should be the recipient name defined with the MobiLink Listener -t+ option.
See -t dblsn option.

Resend interval

VARCHAR

By default, this value is measured in minutes. You can specify S, M, and H for units of seconds, minutes, and hours, respectively. You can also combine units; for example, 1H 30M 10S informs the Notifier to resend the messages every one hour, thirty minutes, and ten seconds.

If this value is null or not specified, the default is to send exactly once, with no resend.

Time to live

VARCHAR

By default, this value is measured in minutes. You can specify S, M, and H for units of seconds, minutes, and hours, respectively. You can also combine units; for example, 3H 30M 10S informs the Notifier to stop resending messages three hours, thirty minutes, and ten seconds after the initial send.

If this value is null or not specified, the default is to send exactly once, with no resend.

A Notifier detects a push request by frequently firing the request_cursor event. By default, a script is not specified for
this event; you must provide a request_cursor event script so that the Notifier can detect push requests. In a typical application,
a request_cursor event script is a SELECT statement. See request_cursor event.

The following example uses the ml_add_property system procedure to create a request_cursor event script for a custom Notifier
named Simple. The SELECT statement informs the Notifier to detect push requests from a table named PushRequest.

The Notifier resends push notifications if the information about the notified device is never updated after being sent and
satisfied according to your business rules. Once push requests are satisfied, you need to prevent the Notifier from detecting
old push requests. You can delete the push requests using a synchronization script if the push notifications were sent for
synchronization purposes.

You can use the request_delete event to delete push requests by their request ID, however, your push request must contain
a request ID column, and you must enable delivery confirmation.