gpt4 book ai didi

ios - 向群组 channel 中的特定 channel 发送消息时,PubNub 功能不起作用?

转载 作者:行者123 更新时间:2023-11-28 05:40:01 24 4
gpt4 key购买 nike

我在 PubNub 仪表板上创建了一个函数,并将 channel 名称指定为组 channel 名称。当我将消息发布到特定 channel 而不是 channel 组时,不会调用此方法。

这是写在控制台上的函数。 enter image description here

我的发布消息代码是

func publishMessage(text : String) {
if text != "" {
let currentTimeMilliSec = System.currentTimeInMilliSeconds()
clientIdentifier?.publish(["messageText": text, "senderID" : UserDefaultsSettings.getLoggedInUserMobNo()!, "createdAt" : currentTimeMilliSec, "channelName" : self.subChannel], toChannel: self.subChannel, withMetadata: ["channelName" : self.subChannel], completion: { (status) in
if !status.isError {
// Message successfully published to specified channel.
} else {
/**
Handle message publish error. Check 'category' property to find
out possible reason because of which request did fail.
*/
}
})
}
}

最佳答案

您不能将 channel 组的名称设置为执行该功能的 channel 名称。您可以使用单个 channel 的名称来执行该函数,也可以使用通配符 root.* 设置 channel 范围来运行该函数。

如果您需要更多信息,请告诉我。

关于ios - 向群组 channel 中的特定 channel 发送消息时,PubNub 功能不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57110299/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com