首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Smack多用户在线聊天列表

Smack多用户在线聊天列表
EN

Stack Overflow用户
提问于 2013-04-12 21:54:52
回答 1查看 1.7K关注 0票数 1

我使用帐户管理员从我的第三方服务器登录到我的openfire XMPP服务器。

我需要在特定的多用户聊天中发现可用的用户。对于“可用”,我指的是房间里所有在线的用户。

我知道一种方法是连接到房间并监听用户的状态,但为了我的目的,我需要动态获得完整的列表。

有可能吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-04-20 05:34:51

是的,您可以使用ServiceDiscovery来完成此操作。下面是一个示例:

代码语言:javascript
复制
      // Obtain the ServiceDiscoveryManager associated with my Connection
      ServiceDiscoveryManager discoManager = ServiceDiscoveryManager.getInstanceFor(connection);

      // Get the items of a given XMPP entity
      // This example gets the items associated with online catalog service
      DiscoverItems discoItems = discoManager.discoverItems("plays.shakespeare.lit");

      // Get the discovered items of the queried XMPP entity
      Iterator it = discoItems.getItems();
      // Display the items of the remote XMPP entity
      while (it.hasNext()) {
          DiscoverItems.Item item = (DiscoverItems.Item) it.next();
          System.out.println(item.getEntityID());
          System.out.println(item.getNode());
          System.out.println(item.getName());
      }
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15973194

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档