如果接收方用户离线,则通过 Ejabberd Api 的 send_message 端点发送时未收到消息
Message not received when sent through send_message endpoint of Ejabberd Api if the receiver user was offline
我正在实现聊天应用程序,我不明白为什么当我使用 ejabberd 的模块 Send_message 时,接收者看不到消息。
我的意思是:
用户B离线,用户A使用ejabberdapi通过https发送消息。 **
当用户B上网时他什么也看不到***
我在客户端使用 smack 并实现了传入消息的侦听器。但我没有看到带有消息扩展名
的传入数据包
I cannot reproduce that problem.
This is how I tested it:
Install ejabberd 21.04, default configuration, start it
register accounts user1@localhost and user2@localhost
Send message using the shell (no need to setup API):
❯ ejabberdctl send_message chat user1@localhost user2@localhost somesubject somebody
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.
我正在实现聊天应用程序,我不明白为什么当我使用 ejabberd 的模块 Send_message 时,接收者看不到消息。
我的意思是:
用户B离线,用户A使用ejabberdapi通过https发送消息。 **
当用户B上网时他什么也看不到***
我在客户端使用 smack 并实现了传入消息的侦听器。但我没有看到带有消息扩展名
的传入数据包I cannot reproduce that problem.
This is how I tested it:
Install ejabberd 21.04, default configuration, start it
register accounts user1@localhost and user2@localhost
Send message using the shell (no need to setup API):
❯ ejabberdctl send_message chat user1@localhost user2@localhost somesubject somebody
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.