简体   繁体   中英

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM