powered by Jive Software

Mutli-user chat implementation

Greetings everybody. I wanted to know how multi-user chat is implemented. It says in JEP-0045 that the server is responsible for sending the message to everybody in the chat room. How does is this implemented in the Jive Messenger? Does it iterate throughout the entire list of JIDs in the room, or is there a faster way to do this?

I believe that the following is the code responsible for sending out a single message in a chatroom to all of the other users. Can anybody confirm this or point out any more functions that are responsible for this?

In SessionManager.java, starting on line 1111:

public void broadcast(Packet packet) throws UnauthorizedException {

Iterator values = sessions.values().iterator();

while (values.hasNext()) {

((SessionMap)values.next()).broadcast(packet);

}

for (Session session : anonymousSessions.values()) {

session.process(packet);

}

}

I’'m pretty sure that all the MUC code is in the MUC package: org.jivesoftware.messenger.muc

-Matt