MultiUserChat.join may cause delays

Current implementation of join has this code:

        // If we've already joined the room, leave it before joining under a new
        // nickname.
        if (joined) {
            try {
                leaveSync();
            }

The comment suggests that we want to leave in case user changed nickname. Makes sense.

However here is scenario: we loose connection then re-connect and start to re-joining groupchats. Some servers (I’ve tested ejabberd) impose a delay when user explicitly leaves the MUC and then joins. The delay is 5 sec. If client has a number of joined chats (like 10) then total delay can be significant. However (I also tested on ejabberd) if you just join MUC (without leaving) there is no delay.

Perhaps ‘if’ statement before leaveSync() could check for nickname change since last join?

Or remove leaveSync() altogether from join, let the caller decide if they need to leave. May affect existing apps though…

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.