The following error codes occurs when you connect iOS device to Relay server

1) Error code 231 and Error code 86 occurs when you are not set the certificate path and url suffix to networkstram params

2) Error code 61 occurs when you have set only RBS Farm ID for SUP connection profile and SUP connection properties. To avoid this error use MBS FarmID      in SUPConnection Properties and RBS FarmID in SUPConnectionProfile

Sample code for connecting iOS device to relay server


//To set up a messaging client connection, use:
SUPApplication *app=[SUPApplication getInstance];
[app setApplicationIdentifier:APPLICATION_IDENTIER];
[app setApplicationCallback:self.callbackHandler];
[Demo_AppDemo_AppDB registerCallbackHandler:self.callbackHandler];

   

    //MBS for device registeration

SUPConnectionProperties* props = app.connectionProperties;
[props setServerName:server];
[props setPortNumber:CONTROL_PORTNUMBER]; //80 HTTP or 443 for HTTPS
[props setNetworkProtocol:CONTROL_PROTOCOL]; // or https for secure connection
[props setUrlSuffix:@”/ias_relay_server/client/rs_client.dll/MBSFARMID/”];
[props setFarmId:CONTROL_FARMID];

  

SUPLoginCredentials* login = [SUPLoginCredentials getInstance];
login.username = app_user; // same as in Application Connection
login.password = nil;
props.loginCredentials = login;
props.activationCode = activation;// same as in Application Connection
props.securityConfiguration =CONTROL_SECURITY_CONFIG;

   

    //RBS for Data synchronization

SUPConnectionProfile *sp = [ Demo_AppDemo_AppDB getSynchronizationProfile];
[sp setUser:scc_username];
[sp setPassword:scc_password];
[sp setAsyncReplay:NO];
[sp setServerName:server];
[sp setPortNumber:CONTROL_PORTNUMBER]; // or 80 for http
[sp setNetworkProtocol:CONTROL_PROTOCOL];

   

    //Import the CA certificate (which is used in Relay server) to your Xcode project

NSString *cer_path=[[NSBundle mainBundle]pathForResource:@”demoapp-certserv-rca” ofType:@”cer”];
NSString *cer_name=[NSString stringWithFormat:@”trusted_certificates=%@”,cer_path];
NSString *params=[NSString stringWithFormat:@”%@;compression=zlib;url_suffix=/ias_relay_server/client/rs_client.dll/RBSFARMID/”,cer_path];

   

    //set the certificate to network stream params

[sp setNetworkStreamParams:params];
[ Demo_AppDemo_AppDB setApplication:app];

   

    //Print the network stram params to ensure that certificate path is added

NSLog(@”NETWORK PARAM %@”,[ Demo_AppDemo_AppDB getSynchronizationProfile].getNetworkStreamParams);

   

if(![ Demo_AppDemo_AppDB databaseExists]){
  
    [ Demo_AppDemo_AppDB createDatabase];
  
    NSLog(@”DB CREATION”);
  
}

   

@try{
    if([SUPApplication registrationStatus]==SUPRegistrationStatus_REGISTERED)
    {
      
        [app startConnection:0];
        NSLog(@”Start app Connection”);
    }
    else
    {
      
        [app registerApplication:0];
        NSLog(@”Register app Connection”);
        return YES;
    }
}
@catch(SUPApplicationTimeoutException *pe){
    NSLog(@”%@ : %@”,[pe name],[pe message]);
  
}
To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply