How to use XEP 198 (flow control) from smack 4.1?

I am new to XMPP. I am using smack for android to provide chat in my application.

Smack 4.1 added flow control support, so I used

XMPPTCPConnection.setUseStreamManagementDefault(true); 

to enable this and I get:

 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 works great both on my client and on the server (ejabberd 15).

But my question is โ†’ should I write my own code to store messages (which are not confirmed by the server) in my android sqlite database and manually send them using chat.sendMessage(); when reconnecting? OR is this part of the repetition done by Smack himself?

I did not have documentation on using XEP 198 on smack 4.1 except XMPPTCPConnection.setUseStreamManagementDefault(true);

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

I saw the yaxim source code, but it looks like they wrote their own code (sending the packages) to support XEP 198 which now runs in Smack 4.1.

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

+6
source share
1 answer
  • Of course, you need to save pending messages and send them when the connection returns.
  • We have one way to listen to the message. Check it out, fooobar.com/questions/984287 / ...
+5
source

Source: https://habr.com/ru/post/984286/


All Articles