0

I recently developed an instant message website using Ejabberd and it seems that some of the messages are being sent twice. Here are the details of the situation.

  1. User A sent multiple message to User B, with the format:

    <body rid='1874291086' xmlns='http://jabber.org/protocol/httpbind' sid='33549457dc8ad98caceedbb648178f26683fcf8a'>
      <message to='284@ejabberd' from='282@ejabberd' type='chat' xmlns='jabber:client' id='efdf6155-a661-46eb-9b54-88b2790f492a'>
      <body>1</body>
      <data timestamp='1501136608657'/>
      <request xmlns='urn:xmpp:receipts'/></message>
    </body>
    
  2. While B receipts the message, returning:

    <body xmlns='http://jabber.org/protocol/httpbind'>
      <message xmlns='jabber:client' xml:lang='en' to='282@ejabberd/9495456281346940375146' from='284@ejabberd/12680356801999428401210' id='5b1d7c22-381c-4332-a4c9-bc9443a9d296'>
      <received xmlns='urn:xmpp:receipts' id='efdf6155-a661-46eb-9b54-88b2790f492a'/>
      </message>
    </body>
    
  3. After a few minutes either of the client would receive:

    <body xmlns='http://jabber.org/protocol/httpbind'>
      <presence xmlns='jabber:client' to='282@ejabberd/13236655690203912299484' from='282@ejabberd/964025387189976270180' type='unavailable'>
        <status xml:lang='en'>Connection failed: connection closed</status>
      </presence>
    </body>
    
  4. The client which receives the above message would send the ping

    <body rid='872290555' xmlns='http://jabber.org/protocol/httpbind' sid='cc0604ed5e728d88216c3bb9124fc39ed574cf5b'/>
    
  5. and that client would again receive all the message that sent to it previously

    <body xmlns='http://jabber.org/protocol/httpbind'><message xmlns='jabber:client' xml:lang='en' to='282@ejabberd/13236655690203912299484' from='284@ejabberd/17094073157455939286404' type='chat'>
      <composing xmlns='http://jabber.org/protocol/chatstates'/></message>
      ... all the messages ...
    </body>
    

I am using Strophe and Ejabberd 17.04, connecting from 5280 port with http-bind, with mod_mam and mod_muc disabled. I do have the logs from Ejabberd but it's pretty large, I could provide if necessary.

The messages would resent every time the client lost the connection, and every single one of the message that is sent to the user will be delivered again.

I am having the annoying issues for a few days, any suggestion would be greatly appreciated. Thank you for your time:)

Vincent Lam
  • 151
  • 2
  • 2
  • 10
  • Are you using the strophe receipts plugin for delivery receipts or some other plugin? – The Maverick Jul 27 '17 at 15:51
  • yes, I am using receipts plugin and also chatstate. But I can confirm that the client did not send the message again. All the messages are coming from Ejabberd server. – Vincent Lam Jul 28 '17 at 04:18
  • could you check the xml logs from the browser. It could be an issue with stream management. In case the client lost the connection and stream management was enabled, you might have to configure the options for stream management. – The Maverick Jul 28 '17 at 19:36
  • @LamteiW Thank you for your reply, I do have stream management enabled on the server, and [https://github.com/strophe/strophejs-plugin-stream-management] (Strophe Stream Mgmt plugin). Here is the configuration on port 5280, `port: 5280 module: ejabberd_http starttls: true certfile: 'CERTFILE' protocol_options: 'TLSOPTS' http_bind: true resend_on_timeout: false stream_management: true resume_timeout: 1200 max_resume_timeout: 1200` and mod_stream_mgmt `mod_stream_mgmt: {}` – Vincent Lam Jul 29 '17 at 03:09

0 Answers0