2

I am currently developing an iOS app using MUC with ejabberd and XMPP. Everything seemed to work fine, until we started to join the user to more than 11 chat rooms at the same time.

The first 11 chat rooms were connected without any problems using the following code:

self.xmppRoomStorage = XMPPRoomCoreDataStorage(databaseFilename: "\(self.roomID).sqlite", storeOptions: nil)
    let roomJID = XMPPJID.jidWithString(roomJid)

    if roomJID != nil && self.xmppRoomStorage != nil {
        print("Preparing to Activating room -> \(roomJID)")

        self.xmppRoom = XMPPRoom(roomStorage: self.xmppRoomStorage, jid: roomJID, dispatchQueue: dispatch_get_main_queue())
        self.xmppRoom!.addDelegate(delegate, delegateQueue: dispatch_get_main_queue())
        self.xmppRoom!.activate(stream)

        self.xmppRoom!.joinRoomUsingNickname(ChatHelper.getLocalUserJid(), history:nil)
    }

When a user has successful joined a room, the following delegate is then called:

func xmppRoom(sender, occupantDidJoin, withPresence)

However, any more than 11 chat rooms, and the user is unable to connect (they can still connect to the first 11). XMPP is not returning an error, it is just saying it failed to join the chat room.

I have tried adding a 1 second delay between each of the dispatch_after(delayTime, dispatch_get_main_queue()) being called but this has not fixed the issue (we thought it might be connecting too fast).

Can anyone suggest what this might be? We are confident Ejabberd is configured correctly but it is hard to know without knowing what to look for...

0 Answers0