1

The default method for subscribing to a channel involves invoking the subscribe method of your client object:

pusher.subscribe('my-channel')

I have an array of channels e.g ['my-channel', 'test-channel']. The events will be generated in any of the channels and i need to listen from each of them.

// Class properties
let pusher = Pusher(key: Config.Constant.pusherAppKey)
var myChannel:PusherChannel?

override func viewDidAppear(animated: Bool) {
    // PUSHER CONNECT?SUBSCRIBE
    self.pusher.connect()
    self.myChannel = self.pusher.subscribe(["temp_testing_channel", "all_test_channels"])
}

But there is an error:

Contextual type 'String' cannot be used with array literal
Ashutosh Jha
  • 150
  • 4
  • 18
  • I don't want to create multiple channels variable and subscribe each to a different one, as number of channels will be dynamic. – Ashutosh Jha Mar 27 '16 at 10:51

1 Answers1

0

Currently this feature is not available. As mentioned by the author. Here is the link

GitHub issue link

Ashutosh Jha
  • 150
  • 4
  • 18