How to subscribe to multiple Pusher public channels?

1.4k views Asked by At

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
1

There are 1 answers

0
Ashutosh Jha On

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

GitHub issue link