Using SA_SEND_UDP to send push notifications

If you are using a SQL Anywhere consolidated database, you can use the SA_SEND_UDP system procedure to send push notifications to a device through a UDP gateway. This method is an alternative to sending push notifications with Notifiers.

By appending a 1 to the end of your original message, and then using that message in the msg argument of a SA_SEND_UDP system procedure, you send the original message to a Listener.

To send a push notification using the SA_SEND_UDP system procedure

This procedure assumes that a Listener is already set up on a device, and is listening for push notifications. The following command is used on the device:

dblsn -l "message=RunBrowser;action='START iexplore.exe http://www.ianywhere.com';"

For demonstration purposes, assume that the Listener loads Internet Explorer whenever it receives a RunBrowser message. This procedure also assumes that a SQL Anywhere consolidated database is running on the MobiLink server.

  1. Run Interactive SQL and connect to your consolidated database.

  2. Execute the following command:

    dbisql -c "dsn=consdb_source_name"

    Replace consdb_source_name with the ODBC name of your consolidated database.

  3. Execute the following command to send the push notification:

    CALL SA_SEND_UDP('device_ip_address', 5001, 'RunBrowser1')

    The first argument ensures that the push notification is sent to the correct device. Replace device_ip_address with the IP address of the device. If you are running the Listener on the same computer as the MobiLink server, use localhost.

    The second argument is the port number. By default, Listeners use port 5001 to listen for UDP.

    The third argument is the message to send with a 1 appended at the end. By appending a 1, which is a reserved server-initiated synchronization protocol, the RunBrowser message is sent to the device using a UDP gateway.

    When the system call is executed, the RunBrowser message is sent to the device, causing the device to run Internet Explorer and load the iAnywhere home page.

For more information about the SA_SEND_UDP system procedure, see sa_send_udp system procedure.