Using PubNub to Implement a Multi-User Mobile Location Control Panel

I am trying to create a sample IOS application that sends location updates from a mobile device from the background to the rails backend, which connects to the postgres database and presents a web interface.

Workflow:

Basically, when a user logs in through ouath in his mobile application, the application goes into the background and continues to send background location data to the server using the pubnub channel. Thus, user X enters the application on his mobile device, and user Y enters it, and they connect to the channel that places them on the panel. Now user M enters the control panel and finds only users X and Y. Another user Z can log in to his mobile phone, but he uses a separate channel (?), And therefore does not appear when M enters the web dashboard, but appears when another user N is registered in

So,

X,Y ==== Channel A ===== User M (Web Dashboard) (Does not see Z)
Z   ==== Channel B(or channel A itself if possible) ==== User N( Web dashboard) (Does not see X,Y)

My question is three times:

1.) Should I create separate channels to implement this for each user of the dashboard, and then connect them separately?

2.) ( IOS7).

3.) , - , , , ?

, pubnub.

, (, - ).? Pubnub API, .

+4
1

PubNub iOS iOS

, . PubNub PubNub.subscribe() LAT/LONG . PubNub.Publish(LAT/LONG) , , .

PubNub

, .

iOS PubNub

iOS7. GeoLocation, PubNub.Publish(LAT/LONG) . iOS: http://mobile.tutsplus.com/tutorials/iphone/ios-multitasking-background-location/ didUpdateToLocation. .

locationManager = [[CLLocationManager alloc] init];
[locationManager setDelegate:self];

// Increased Accuracy is used only when app is Visible/Open.
// Otherwise only significant changes are transmittable.
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];

- (void)
locationManager:     (CLLocationManager *)manager 
didUpdateToLocation: (CLLocation *)newLocation 
fromLocation:        (CLLocation *)oldLocation {
    CLLocationCoordinate2D currentCoordinates = newLocation.coordinate;
    NSLog(
        @" NEW LOCATION: Lat(%f) Long(%f)", 
        currentCoordinates.latitude,
        currentCoordinates.longitude
    );

    // Define a channel
    PNChannel *channel_1 = [PNChannel channelWithName:@"a" shouldObservePresence:NO];

    // Send Lat/Long
    [PubNub sendMessage:@{@"lat":currentCoordinates.latitude,@"long":currentCoordinates.longitude}  toChannel:channel_1];
}

PubNub iOS: https://github.com/pubnub/objective-c/tree/master/iOS#lets-start-coding-now-with-pubnub

PubNub

PubNub . , 1. 24- , . 24 0.

PubNub

PubNub , .

+2

All Articles