如何获取openfire服务器中所有房间的列表

How to get the list of all rooms in openfire server

有人可以指导我如何使用 strophe.js 检索 openfire 中所有可用房间的列表。我没有找到与该主题相关的任何真正有用的内容。 谢谢

我花了几个小时找到解决方案,但比预期的要容易。我将添加这部分代码,因此将来可能会有人需要它。

        getListRooms = function(server){
        var iq;
        iq = $iq({
          to: server,
          from: connection.jid,
          type: "get"
        }).c("query", {
          xmlns: Strophe.NS.DISCO_ITEMS
        });
      connection.sendIQ(iq.tree(), function (iq) {
        console.log(iq);
        if (!iq || iq.length == 0)
            return;
        //jquery load data after loading the page.This function updates data after jQuery loading
        $rootScope.$apply(function () {

            $(iq).find("item").each(function () {
//your function to update
 });
        });
        console.log('success, all rooms received'); }, function (err) { console.log('error, something went wrong with rooms receivig', err); });
    }