[ejabberd] Send to all resources (update)

Konstantin Khomoutov flatworm at users.sourceforge.net
Fri Jul 16 21:29:40 MSD 2010


On Fri, 16 Jul 2010 11:24:17 +0100
rod <rod at pu-gh.com> wrote:

> I asked a question about ejabberd's ability to send message stanzas to
> all of a users resources, and have found some info in the RFC which
> explains the behaviour contrary to this:
> 
> http://xmpp.org/rfcs/rfc3921.html#rfc.section.4.1
> 
> But some other XMPP servers provide a "sync" mode where this behaviour
> will be the case.  Is there such a thing in ejabberd?
> 
> My clients are send messages to user at domain, but when this gets routed
> by ejabberd it sticks on the resource so the receiver gets the message
> *from* user at domain/resource.  I need it to not do this and maintain
> the message is from user at domain

I think you are missing the point of the behaviour specified by the RFC
and hence trying to solve the wrong problem.

The chief issue here, which you seem to ignore, is that no sensible
receiver is able to chat from *all its connected resources at once*,
and here's why: even if the receiver's server would deliver the sender's
messages to all the receiver's resources, ignoring their priorities, the
receiver would only be able to send its replies from only one of
its resources at a time, and this means it would not have the same
conversation context on all the resources. Note that this is one-to-one
type of conversation, and "the one" here means one resource.

In your case, I think the best method to solve the problem is to prevent
the user from opening multiple sessions for the same account in the same
browser: just make all of them bind to the same resource (inferred
from a stored cookie or whatnot) and then any misguided attempt to open
another instance of the chat client will disconnect the existing
session, if it exists.
On the other hand, if your chat client is "browser-global" (that is,
any instance opened in a tab "knows" about all the other instances
already opened in the same browser), make it detect if a session for
the account the user is trying to use is already active and present the
user appropriate explanations and a question about if she's really sure.


More information about the ejabberd mailing list