powered by Jive Software

Discovery of available MUC rooms


quick question. How would I discover what groups are available on a muc-enabled server?




You should use disco in order to discover the rooms hosted by the MUC service. Take a look at this code sample to get the general idea:

// Discover the room hosted by the service
    // Note: "muc.company.com" is the muc service name
    DiscoverItems result = serviceDiscoveryManager.discoverItems("muc.company.com");
    // Print to the console the room JID of each room
    for (Iterator items=result.getItems(); items.hasNext();) {
        System.out.println("Room JID:" + ((DiscoverItems.Item)items.next()).getEntityID());

In Smack 1.4.0, Iā€™'ll add support for this discovery at a higher level.


ā€“ Gato

Great. Works fine for me!