Multiple login over an account?


I’m now trying the Smack library, but I notice one thing, it is that

an existing message listener will not work if the account is logged in elsewhere later

(i.e. the listener will not raise notifications any more).

Is it expected?

If it is, how do I know if the account is already logged in?

If it isn’t, how should I make the listener work properly?


This is dependent on how the message is addressed. If it is to a full jid, then it should work as expected. If it is addressed to the base JID (which is most likely what you are seeing), it’s behaviour can vary. The server will either choose the priority client and deliver it to that one, or it will deliver it to all of them. You seem to be seeing the first case.

Glad that someone offers help!

I’ve googled a bit and got

(“Decentralization and addressing”).

So a full jid’s like userfoo@xxx/yyy?

Coz I only used userfoo@xxx for the two different client of the same user.

Is there any rule of determining yyy?


The server will determine priority based on its own algorithm (I believe). Depending on your server, it can also be configured to deliver to all clients instead of just one, as both methods are considered acceptable by the spec.

OpenFire has such a property, and the Google Talk server does it by default.