【问题标题】:MUC Light using XMPPFramework使用 XMPPFramework 的 MUC Light
【发布时间】:2017-05-03 01:00:34
【问题描述】:

有没有人能够在 ios 上使用 xmppframework 实现 mongooseim 的 muc light (xep-xxx)? 我一直在尝试创建一个房间,但到目前为止没有任何进展。每当我尝试发送创建 muc 灯的请求时,我都无法收到来自 mongooseim 服务器的任何响应。

我试过的代码是:

let roomTitle = "\(title)@muclight.hostname.co"
    print("Creating room: \(roomTitle)")
    let room = XMPPRoomLight(roomLightStorage: nil, jid: XMPPJID(string: roomTitle), roomname: "testroom", dispatchQueue: DispatchQueue.main)
    let delegate = UIApplication.shared.delegate as! AppDelegate
    room.addDelegate(self, delegateQueue: DispatchQueue.main)
    room.createRoomLight(withMembersJID: [(delegate.xmppStream?.myJID)!])
    room.activate(delegate.xmppStream)

上面的代码似乎不起作用,我在网上的任何地方都找不到有关如何使用 xmppframework 执行此操作的演示。我通过取消注释以下行在 ejabberd.cfg 中启用了 mod_muc_light:

{mod_muc_light, [{host, "muclight.@HOST@"}]}

【问题讨论】:

    标签: ios swift ejabberd xmppframework mongoose-im


    【解决方案1】:

    参考本文档,一步步配置MUC Light Room和聊天:

    这适用于 Mongoose IM,但大多数项目与 ejabberd 配置相同。只需阅读条款即可获得想法。

    主要来源:https://github.com/esl/MongooseIM

    MUCLight: https://github.com/esl/MongooseIM/blob/master/doc/open-extensions/muc_light.md

    【讨论】:

      【解决方案2】:

      看来你需要为你的房间添加配置。

      let query = DDXMLElement(name: "query", xmlns: "urn:xmpp:muclight:0#create")
          let configuraton = DDXMLElement(name: "configuration")
          configuraton.addChild(DDXMLElement(name: "roomname", stringValue: roomName))
          let occupants = DDXMLElement(name: "occupants")
          let users = DDXMLElement(name: "user", stringValue: (XMPPJID(string: "ijpxs3blss@localhost")?.bare)!)
          users.addAttribute(withName: "affiliation", stringValue: "member")
          occupants.addChild(users)
          query.addChild(configuraton)
          query.addChild(occupants)
      

      在结束通话时

      room.setconfiguration(query)
      

      【讨论】:

        猜你喜欢
        • 2012-05-09
        • 2012-06-01
        • 2016-02-06
        • 2013-10-16
        • 2017-06-29
        • 2013-09-04
        • 2017-09-10
        • 2017-03-17
        • 2016-05-23
        相关资源
        最近更新 更多