Messaging Client API

The Sybase Unwired Platform messaging client (SUPMessageClient) API is part of the libclientrt library. The messaging client is responsible for setting up a connection between the user application and the server, as well as sending client messages up to the Unwired Server and receiving the import messages sent down to the client.

The Messaging Client API consists of the following methods:

+(void)setAssertionState:(BOOL)hideAssertions;

Determines whether assertions should appear or not.

+(NSInteger)start

Starts the messaging client and connects to the Unwired Server. You must use the settings application to enter the Sybase Unwired Platform user preferences information, including server name, port, user name, and activation code.

The parameters server name, user name, serverport, companyID and activation correspond to the Unwired Server name, the user name registered with the Unwired Server, the port the Unwired Server is listening to, the company ID, and activation code, respectively. If a Relay Server is used, ‘companyID’ corresponds to the farm ID of the Relay Server.

To ensure that messages are routed to the correct client application, the messaging client code sends the application executable name (specifically, the first 16 characters of the CFBundleExecutable value from the application’s Info.plist) to the Unwired Server. The Unwired Server requires that each application on a device (or simulator) connect to the Unwired Server with a different user name.

This call returns one of the following values as defined in SUPMessageClient.h.

Note: Ensure that the package database exists (either from a previous run, or a call to [SampleApp_SampleAppDB createDatabase]) and that [SampleApp_SampleAppDB startBackgroundSynchronization] is called before calling [SUPMessageClient start].

The following code example shows the start method:

NSInteger result = [SUPMessageClient start];

if (result == kSUPMessageClientSuccess)
{
  //Continue with your application
}
// At this point, if the result is a NO, then the client 
// application can decide to quit or throw a message alerting 
// the user that the connection to the server was
// unsuccessful.
+(NSInteger)stop

Stops the messaging client.

[SUPMessageClient  stop];
+(NSInteger)restart

Restarts the messaging client. Returns YES when successful, otherwise, if the required preferences are not set, or an error occurred when restarting the client, returns NO.

NSInteger result = [SUPMessageClient restart];
+(BOOL)provisioned

Checks if all the required provisioning information is set. Returns NO when required preferences are not set, andYES when all the required information is set.

BOOL result = [SUPMessageClient provisioned];
+(int)status
Returns the last status received from messaging client, as one of the following values:
  • 0 – not started
  • 1 – started, not connected
  • 2 – started, connected
int result = [SUPMessageClient status];
Related concepts
Query APIs
Installing and Testing X.509 Certificates on iOS Clients
Related reference
Connection APIs
Message-Based Synchronization APIs
Operations APIs
Local Business Object
Personalization APIs
Object State APIs
Security APIs
Single Sign-On With X.509 Certificate Related Object API
Utility APIs
Complex Attribute Types
Exceptions
MetaData and Object Manager API