OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

subscribeToChannels not working in cab application

  • Thread starter Thread starter Kite
  • Start date Start date
K

Kite

Guest
I working on cab application, in which there is app for driver. I have to configure PubNub and subscribe to driver channel for particular driver.

So what I did is:

First configure client:

Code:
PNConfiguration *configuration = [PNConfiguration configurationWithPublishKey:kPublishKey subscribeKey:kSubscribeKey];
self.client = [PubNub clientWithConfiguration:configuration];
[self.client addListener:self];

Than after I subscribe to channel in that channel contain all driver so I send CAB_ID for that driver who logged in like:

Code:
  NSDictionary *clientState = @{@"id": [[dicData valueForKey:@"data"] valueForKey:@"id"],
                                 @"rate": @"1.77",
                                 @"price": @"4",
                                 @"status" : @"Online",
                                 @"hold": @"0",
                                 @"ac_type": @"0",
                                 @"gender": [[dicData valueForKey:@"data"] valueForKey:@"gender"],
                                 @"bearing": @"213.68757972878151",
                                 @"lng": [NSString stringWithFormat:@"%f",longitude],
                                 @"lat": [NSString stringWithFormat:@"%f",latitude],
                                 @"driver_type": [[dicData valueForKey:@"data"] valueForKey:@"profile_type"],
                                 @"cab_type": @"hatchback",
                                 @"full_name": [[dicData valueForKey:@"data"] valueForKey:@"first_name"]
                                 };
    
    [self.client subscribeToChannels:@[kDriverMyChannel,@"CAB_250"] withPresence:YES clientState:clientState];

but it is not effecting my panel, it is not logging to driver channel. Please help.
<p>I working on cab application, in which there is app for driver.
I have to configure PubNub and subscribe to driver channel for particular driver.</p>
<p>So what I did is:</p>
<p>First configure client:</p>
<pre><code>PNConfiguration *configuration = [PNConfiguration configurationWithPublishKey:kPublishKey subscribeKey:kSubscribeKey];
self.client = [PubNub clientWithConfiguration:configuration];
[self.client addListener:self];
</code></pre>
<p>Than after I subscribe to channel in that channel contain all driver so I send CAB_ID for that driver who logged in like:</p>
<pre><code> NSDictionary *clientState = @{@"id": [[dicData valueForKey:@"data"] valueForKey:@"id"],
@"rate": @"1.77",
@"price": @"4",
@"status" : @"Online",
@"hold": @"0",
@"ac_type": @"0",
@"gender": [[dicData valueForKey:@"data"] valueForKey:@"gender"],
@"bearing": @"213.68757972878151",
@"lng": [NSString stringWithFormat:@"%f",longitude],
@"lat": [NSString stringWithFormat:@"%f",latitude],
@"driver_type": [[dicData valueForKey:@"data"] valueForKey:@"profile_type"],
@"cab_type": @"hatchback",
@"full_name": [[dicData valueForKey:@"data"] valueForKey:@"first_name"]
};

[self.client subscribeToChannels:@[kDriverMyChannel,@"CAB_250"] withPresence:YES clientState:clientState];
</code></pre>
<p>but it is not effecting my panel, it is not logging to driver channel.
Please help.</p>
Continue reading...
 
Top