How to use XEP 198 (Stream Management) from smack 4.1?
Asked Answered
U

1

7

I am new to XMPP. I'm using smack on android for providing chat in my application.

In smack 4.1, support for stream management is added so I used

  XMPPTCPConnection.setUseStreamManagementDefault(true);

to enable this and I'm getting :

03-27 00:50:54.945: D/SMACK(16991): SENT (5): <enable xmlns='urn:xmpp:sm:3' resume='true'/>
03-27 00:50:55.740: D/SMACK(16991): RECV (5): <enabled xmlns='urn:xmpp:sm:3' id='g2gCbQAAAAVTbWFja2gDYgAABZNiAAYRuGIAAW06' resume='true' max='300'/>

So, XEP 198 is working fine both on my client and the server(ejabberd 15).

But my question is -> do I have to write my own code for storing the messages(which are not acknowledged by the server) into my android sqlite database and manually resend them using chat.sendMessage(); when the connection is reconnected? OR is this resending part is done by Smack itself?

I didnt get any documentation for using XEP 198 on smack 4.1 other than XMPPTCPConnection.setUseStreamManagementDefault(true);

Is there any method available from smack for listening to the <a/> received from the server?

I have seen source code of yaxim, but it seems they have written their own code(by sending packets) for supporting XEP 198 which is now done in Smack 4.1.

Please help me with what should I do after enabling this support?

Upstanding answered 26/3, 2015 at 20:12 Comment(1)
I know that the documentation about Stream Management is missing. But since Smack is open source you could try if looking at the source answers a few questions.Attired
P
6
  1. Of course you need to store your pending messages and resend them when connection is back.
  2. We have one way to listen message ack. Check out this, https://mcmap.net/q/1624116/-android-smack-server-receipt-ack
Paregoric answered 18/5, 2016 at 3:45 Comment(1)
when i'm offline that time ejabbered forward message via FCM are repeat when i'm coming online in ejabbered channel so , what i have to do in my case?Bronk

© 2022 - 2024 — McMap. All rights reserved.