xmpp中的单线程一对一聊天名册列表

时间:2018-09-03 13:17:16

标签: typescript

我正在尝试从离子2中的xmpp聊天到“所有花名册”列表,但是我找不到它。

    allRoster() {   
        this.connection.muc.init(this.connection);
        return new Promise<any>(resolve => {
          this.connection.muc.queryOccupants(this.CONFERENCE_SERVICE, function (msg) {
            let items = [];
            let rosters = msg.querySelectorAll('item');

            rosters.forEach(function (roster) {
              items.push({
                id: roster.getAttribute("jid"),
                name: roster.getAttribute("name") || roster.getAttribute("jid"),
                lastText: 'Available to Chat',
                avata: 'assets/imgs/ben.png'
              });
            });

            resolve(items);
          }, function (err) {
            console.log("rooms - error: " + err);
            console.log(err);
          })
        });
      }

0 个答案:

没有答案