有没有人能够在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@"}]}
答案 0 :(得分:0)
请参阅此文档以按照分步配置制作MUC灯光室并聊天:
这适用于Mongoose IM,但大多数项目与ejabberd配置相同。只要读出这些术语就能得到一个想法。
主要来源: https://github.com/esl/MongooseIM
MUCLight: https://github.com/esl/MongooseIM/blob/master/doc/open-extensions/muc_light.md
答案 1 :(得分:0)
似乎您需要为房间添加配置。
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)