New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for XEP-0198 Stream Management #698

Open
boothj5 opened this Issue Dec 29, 2015 · 12 comments

Comments

Projects
None yet
3 participants
@boothj5
Copy link
Owner

boothj5 commented Dec 29, 2015

http://xmpp.org/extensions/xep-0198.html

Probably requires changes to libmesode/libstrophe.

@pasis

This comment has been minimized.

Copy link
Collaborator

pasis commented Dec 29, 2015

As I understand from the document, libstrophe doesn't have to be changed. Moreover, sending <enable/> from profanity simplifies management of the reply. And profanity can send <r/> only after <enabled/> is received.

@boothj5

This comment has been minimized.

Copy link
Owner Author

boothj5 commented Dec 29, 2015

Useful thanks. I haven't looked into it much yet, but think it'd be a good feature.

@andreygursky

This comment has been minimized.

Copy link

andreygursky commented Jun 21, 2017

Missing stream management would mean profanity is still not the best choice for a laptop using sleep / hibernate / WLAN / Mobile Internet connection?

@pasis

This comment has been minimized.

Copy link
Collaborator

pasis commented Jun 21, 2017

@andreygursky, Profanity supports automatic re-connection and pings. These are enough to detect connection drop and re-connect.

@andreygursky

This comment has been minimized.

Copy link

andreygursky commented Jul 12, 2017

@pasis, thanks for the info. But I still in doubt. When someone sends me a message, it will arrive at my XMPP server, which will send it to me and it will get lost. Only once a 5-6 minutes timeout expires, the server would mark me offline and since then it will save the messages. Or I'm missing something?

@pasis

This comment has been minimized.

Copy link
Collaborator

pasis commented Jul 12, 2017

@andreygursky, you are right, limited number of messages may be lost in your scenario. Because server sends tcp segments until it fills the tcp window. And there is no interface to find what segments are ack'ed in tcp stream. I read xep-198 and it sounds interesting. However, it should be implemented in libstrophe instead of Profanity. I will take a look.

@andreygursky

This comment has been minimized.

Copy link

andreygursky commented Jul 14, 2017

However, it should be implemented in libstrophe instead of Profanity.

Looking at readme of libstrophe:

Its goals are:
...
reliable

it seems, that xep-198 support should be essential for the library.

I will take a look.

Looking forward, hope you could start it and get some basic (without corner cases) support or at least pass-through functions at right places (with possible refactoring). Then it would be easier for others to join the work.

@pasis

This comment has been minimized.

Copy link
Collaborator

pasis commented Jul 15, 2017

Check xep-0198 branch in libstrophe: https://github.com/strophe/libstrophe/tree/xep-0198 . Libstrophe enables stream management and responds to request stanzas with ack ones.

Sending stanza by libstrophe is pointless without cooperation with the main program and I don't know a good interface for this yet.

Resume functionality is not implemented as well.

@andreygursky

This comment has been minimized.

Copy link

andreygursky commented Jul 20, 2017

@pasis, thanks!

Sending stanza by libstrophe is pointless without cooperation with the main program and I don't know a good interface for this yet.

Do you mean exporting xmpp_... API to be used in something like examples/basic.c?

@pasis

This comment has been minimized.

Copy link
Collaborator

pasis commented Jul 20, 2017

@andreygursky, I'll try to explain in details. Client (libstrophe) doesn't resend stanza within one connection. Because TCP guarantees that all stanzas delivered in order or TCP connection fails. Therefore, number of handled stanzas are required only for resending messages (or other data) after reconnection and resuming previous session.

Libstrophe would need to know high level logic of stanzas to resend them within restored session. But libstrophe provides only low-level interface and only user (xmpp program) assigns logic to stanzas. As example, you can create your own application which implements your own RPC mechanism over XMPP. You can create your own stanzas like <my-stanza/>.

Why would libstrophe need to know the logic? Some stanzas are pointless to resend (e.g. ping). But more important that client can exchange multiple stanzas in order to achieve some result. In this case I'm not sure if the next statements will be handled properly:

  • All these stanzas must be delivered and handled as part of a single protocol/session. There is a situation possible when first half of stanzas discarded on disconnect.
  • When client reconnects and resumes previous session, how should it handle initial <presence/>? How remote contacts will see the client: offline->online, always online or offline?

Maybe XEP-0198 describes the above situations and I missed that during reading.

I won't implement client's part of XEP-0198 until I understand it clearly.

@andreygursky

This comment has been minimized.

Copy link

andreygursky commented Jul 22, 2017

@pasis, thanks for your explanations.

Why would libstrophe need to know the logic? Some stanzas are pointless to resend (e.g. ping).

I hope, it still could be avoided. If a client has issued some stanzas, then it expects each will be delivered and if needed answered, even a ping one. What becomes a "resend" for libstrophe is actually a "send" from a client point of view, which shouldn't disappear.

All these stanzas must be delivered and handled as part of a single protocol/session. There is a situation possible when first half of stanzas discarded on disconnect.

Do you mean discarded by the server? I've supposed, that the xep ensures for both client and server also, that disconnects do not interfere the session integrity.

When client reconnects and resumes previous session, how should it handle initial ? How remote contacts will see the client: offline->online, always online or offline?

In Gajim I see often:

[15:10:56] ‎SOME_JID is now Offline (Replaced by new connection)
‎[15:10:58] SOME_JID is now Available

Perhaps it is how session restore looks like, thus not a big problem?

P.S. Could opening a bug on libstrophe attract the attention of other libstrophe devs? Or all of them are also here in profanity?

@pasis

This comment has been minimized.

Copy link
Collaborator

pasis commented Aug 3, 2017

P.S. Could opening a bug on libstrophe attract the attention of other libstrophe devs? Or all of them are also here in profanity?

@andreygursky, I'm afraid there is no other active libstrophe devs you're talking about. Also I'm quite busy now too, so will look into this in few months maybe.

There are contributors that commit to libstrophe time to time though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment