【问题标题】:XMPPFramework : Only occupants are allowed to send messages to the conference xmpp iosXMPPFramework : 只允许占用者向会议 xmpp ios 发送消息
【发布时间】:2016-10-25 21:59:58
【问题描述】:

为什么尝试在 xmpp muc 中创建的组中发送消息时出现此错误。

这是我收到的消息包

<message xmlns="jabber:client" from="testgrp@conference.localhost" to="7023651847@localhost/787052459360862999820058" type="error"><body>hiiii</body><error code="406" type="modify"><not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></not-acceptable><text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Only occupants are allowed to send messages to the conference</text></error></message>

错误文本:只允许占用者向会议发送消息

我用来创建组的方法是:XMPPFramework - How to create a MUC room and invite users?

【问题讨论】:

    标签: ios iphone xmpp


    【解决方案1】:

    错误消息似乎不言自明:您不是居住者(如 XEP-0045 中的定义 = 您没有加入房间),因此您无法发送消息。

    您可以查看 XEP-0045 中的角色权限以供参考:http://xmpp.org/extensions/xep-0045.html#roles-priv

    只有参与者可以向所有人发送消息。

    【讨论】:

    • 你是对的,但是当我第一次加入房间并聊天时,在关闭我的客户端 ios 应用程序并重新启动应用程序之后,如果我发送消息它会显示此错误,则不会发生这种情况。嗯,这是实际的问题
    • 当您加入时,您就是一名居住者。当您关闭应用程序时,客户端正在离线发送状态,包括发送到 MUC,并且您不再是占用者。这意味着如果您想再次成为居住者并被允许发送消息,则需要在登录时再次加入。这种行为在 XEP-0045 中有很好的定义。
    • @MickaëlRémond 你能检查一下代码有什么问题吗?让 roomStorage = XMPPRoomCoreDataStorage.sharedInstance() 让 roomJid = XMPPJID.init(string: "(groupName)@conference.(constantVar.hostUrl)") 让 xmppRoom = XMPPRoom.init(roomStorage: roomStorage, jid: roomJid, dispatchQueue: DispatchQueue. main) as XMPPRoom xmppRoom.activate(self.xmppStream) xmppRoom.addDelegate(self, delegateQueue: DispatchQueue.main) xmppRoom.join(usingNickname: self.xmppStream.myJID.bare(), history: nil, password: nil)跨度>
    猜你喜欢
    • 1970-01-01
    • 2011-05-26
    • 2015-08-24
    • 2012-06-21
    • 1970-01-01
    • 2012-10-26
    • 1970-01-01
    • 2015-06-02
    相关资源
    最近更新 更多