简体   繁体   中英

xmpp ios: How to retrieve all registered users from openfire Server

In my iOS chatting application, I am using Openfire Server. I am retrieving particular user friends list, but now I want to retrieve all registered users from Openfire Server. Please help me.

func  getRosterDetails(){
    do {
        var query = try? XMLElement(xmlString: "<query xmlns: jabber:iq:roster/>")

        var iq = XMPPIQ(type: "get", to: XMPPJID.init(string: "domainname"), elementID: appDelegate.xmppStream?.generateUUID(), child: query)
        appDelegate.xmppStream?.send(iq)
    } catch let err  {
    }
}
func xmppStream(_ sender: XMPPStream!, didReceive iq: XMPPIQ!) -> Bool {

}//this delegates returns zero users ,but in my server i have users

In XMPP Protocol there is no such specification to retrieve all the registered users. However the same is possible using some plugins but over HTTP.

Same problem is already answered here in context of HTTP: https://stackoverflow.com/a/46871082/6041485

You can use Openfire Rest-API Plugin for this purpose and getting all registered users can be done by hitting following URL:

GET http://example.org:9090/plugins/restapi/v1/users

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM