Created
September 27, 2014 03:53
-
-
Save drnugent/83ea189b1e21ecb9066c to your computer and use it in GitHub Desktop.
PubNub iOS Publish Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// (In ViewController.m add to viewDidLoad:) | |
[PubNub setConfiguration:[PNConfiguration defaultConfiguration]]; | |
[PubNub connect]; | |
PNChannel *channel_1 = [PNChannel channelWithName:@"a" shouldObservePresence:YES]; | |
[PubNub subscribeOnChannel:channel_1]; | |
[PubNub sendMessage:@"Hello from PubNub iOS!" toChannel:channel_1]; | |
- (void)pubnubClient:(PubNub *)client didReceiveMessage:(PNMessage *)message { | |
NSLog( @"%@", [NSString stringWithFormat:@"received: %@", message.message] ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment