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
class SharedWatchData: NSObject, WCSessionDelegate, PNObjectEventListener { | |
func client(client: PubNub!, didReceivePresenceEvent event: PNPresenceEventResult!) { | |
print("PubNubs did receive presence event: \(event.data.presenceEvent)") | |
} | |
func client(client: PubNub!, didReceiveMessage message: PNMessageResult!) { | |
print("PubNub did receive message: \(message.data.message)") | |
} | |
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
let config = PNConfiguration(publishKey: self.publishKey, subscribeKey: self.subscribeKey) | |
config.origin = "pubsub.pubnub.com" | |
self.pubNubClient = PubNub.clientWithConfiguration(config) | |
self.pubNubClient?.addListener(self) | |
self.pubNubClient?.subscribeToChannels([channel], withPresence: true) |