Question

I'm currently using the aSmack library to do an XMPP client for Android.

One thing that I'm wondering is, what happens if two users each create a chat with the other person? For example the first client will do:

    connection.getChatManager().createChat("testing2@testing.com", new MessageListener() {
            @Override
            public void processMessage(Chat arg0, Message arg1) {
                                //.....
            }
        });

And the second client will do:

    connection.getChatManager().createChat("testing1@testing.com", new MessageListener() {
            @Override
            public void processMessage(Chat arg0, Message arg1) {
                                //.....
            }
        });

Will there be two chat instances on the server, and so the message listeners won't pick up any messages, since they will be coming from a different chat?

Or will the server automatically synchronize the chat threads into one, and so the message listeners will work correctly and be able to intercept the incoming messages?

If it's the first scenario, then what possible solutions are there to solve that problem so as to merge the chats into one?

Edit: I've just tried it on a quick example and it seems it's the first case, though I'm unsure if it's because I did something incorrectly.

Was it helpful?

Solution

XMPP servers are not aware of the two chat threads you created in your example and therefore unable to synchronize them. This is by design. A XMPP chat is simply a set of message stanzas with the same thread id.

I recommend reading RFC 6121 5.2.1.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top