Skip to content

Instantly share code, notes, and snippets.

@drnugent
Created September 27, 2014 03:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drnugent/83ea189b1e21ecb9066c to your computer and use it in GitHub Desktop.
Save drnugent/83ea189b1e21ecb9066c to your computer and use it in GitHub Desktop.
PubNub iOS Publish Example
// (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