0
votes

I have a web chat application, when user 1 login by one account in many browsers with difference resource and send a message to user 2.

Ex: user 1 login in chrome with jid: user1@localhost/chrome user 1 login in chrome whit jid: user1@localhost/firefox

User 1 in chrome send chat message for user2 with content "hello".

I got a problem here, ejabberd server just send "hello" to user2, but I want server also send a copy of "hello" for all user 1 in chrome and firefox.

How can I do it?

1
I'm not sure if ejabberd supports it, but for this use case you'd probably use XEP-0280: Message Carbons.legoscia

1 Answers

-1
votes

Yes, ejabberd support carbon message. My solution is: after sending a message, I send a copy of message for my self by setting "to" is my barejid and replace "type" is "copy" (my custom type):

<message to='[email protected]' type='copy' id='5ea1f7d8-1961-c9dc-b599-55a89438491b' xmlns='jabber:client'>

<body>hello</body>

<x >
   <to>[email protected]</to>
</x>