Message not received when sent through send_message endpoint of Ejabberd Api if the receiver user was offline

330 views Asked by At

I am implementing chat app and I can't understand why when I use modulue Send_message of ejabberd the receiver does not see the message.

I mean :

  • User B is offline and user A send a message using ejabberd api through https. **

  • when user B gets online he sees nothing ***

I am using smack in client side and I implemented the listener for incoming messages. but I see no incoming packet with Message extension

1

There are 1 answers

1
Badlop On BEST ANSWER

I cannot reproduce that problem.

This is how I tested it:

  1. Install ejabberd 21.04, default configuration, start it

  2. register accounts user1@localhost and user2@localhost

  3. Send message using the shell (no need to setup API):

    ❯ ejabberdctl send_message chat user1@localhost user2@localhost somesubject somebody

  4. Then login to account user2@localhost using a good desktop Jabber client, for example Gajim, Psi, Tkabber, ... After logging in, the client receives

<message to='user2@localhost'
from='user1@localhost'
type='chat'
id='13012384106679348680'>
  <archived by='user2@localhost'
id='1621974627878891'
xmlns='urn:xmpp:mam:tmp'/>
  <stanza-id by='user2@localhost'
id='1621974627878891'
xmlns='urn:xmpp:sid:0'/>
  <delay from='localhost'
stamp='2021-05-25T20:30:27.879994Z'
xmlns='urn:xmpp:delay'>Offline storage</delay>
  <body>somebody</body>
  <subject>somesubject</subject>
</message>

Things you must try:

  • Your client must login, send presence with positive priority, in order to receive offline messages.
  • Try using a Jabber client to receive the messages, maybe the problem is in your client.
  • And also try using the ejabberdctl script. Maybe the problem is in your API call method.