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.swift

import UIKit
import PubNub
import PubNubBridge


@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?
    var client: PubNub?

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        self.client = PubNub.client()
        self.client?.addListener(self)
        self.client?.subscribeToChannels(["lobby"], withPresence: false)
        return true
    }
}