【问题标题】:How to subscribe to multiple Pusher public channels?如何订阅多个 Pusher 公共频道?
【发布时间】:2016-07-14 17:44:39
【问题描述】:

订阅频道的默认方法涉及调用客户端对象的订阅方法:

pusher.subscribe('my-channel')

我有一个频道数组,例如 ['my-channel', 'test-channel']。事件将在任何频道中生成,我需要从每个频道中收听。

// 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"])
}

但是有一个错误:

Contextual type 'String' cannot be used with array literal

【问题讨论】:

  • 我不想创建多个频道变量并为每个频道订阅不同的频道,因为频道的数量是动态的。

标签: ios swift pusherswift


【解决方案1】:

目前此功能不可用。正如作者所说。这是链接

GitHub issue link

【讨论】:

    猜你喜欢
    • 2014-07-15
    • 1970-01-01
    • 2013-08-10
    • 2017-05-26
    • 2015-06-05
    • 1970-01-01
    • 1970-01-01
    • 2017-05-12
    • 1970-01-01
    相关资源
    最近更新 更多