1 Subscribe to channels

To receive messages from other users in real-time, you must subscribe to the desired channels first.

Click to copy the blue snippets and then paste them into your code.

AppDelegate.m

#import "AppDelegate.h"
#import <PubNub/PubNub.h>
#import <PubNubBridge/PubNub+FAB.h>


@interface AppDelegate ()

@property (nonatomic, strong) PubNub *client;

@end


@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.client = [PubNub client];
    [self.client addListener:self];
    [self.client subscribeToChannels:@[@"announcements", @"lobby"] withPresence:NO];
    return YES;
}

@end