I know lots of other people have had problems getting these to work, and it seems I am the latest. Both methods on MultiUserChat seem very unreliable, almost like they have race conditions.
Basically, I have registered a participant listener with the MultiUserChat, which calls muc.getOccupants() and muc.getOccupantCount(). The participant listener is getting fired when users join / leave chat rooms, but the getOccupants() and getOccupantCount() methods return very unpredictable / unreliable results. Here’s a list of results I get that seem to be random and cannot be tracked down to any pattern:
- Sometimes it works if I am the first person to join the room. getOccupantCount returns 1, and and getOccupants() has one user.
- Sometimes it returns 0 when I am the first person to join the room.
- Sometimes if another person joins the room. It updates to show the fact that I am in the room, but doesn’t show the second person. Thinking there is only me in the room.
- Sometimes it almost seems to operate in reverse. A user is shown as being added to the getOccupant() list when they leave the room, and as being removed from the list when they join the room. getOccupantCount() also reflects the incorrect number of users, incrementing when the user leaves the room, and decrementing when the user joins the room.
Thanks for any help in advance.