1

What is a proven lightweight application level way to guarantee the delivery of messages? I have done some reading on using sequence numbers and acknowledging the receipt of these, but there might be better ways? The transport is currently tcp, but that might change.

krakers
  • 111
  • 10
  • Why do you want to change from tcp? Is the stack too big for you deployment platform? Do you not want congestion control? – FormerNcp Oct 06 '18 at 15:30
  • The question is really about message receipt guarantees, acknowledgement in the application level. – krakers Oct 06 '18 at 16:49
  • [http://stackoverflow.com/questions/44255697/are-application-level-retransmission-and-acknowledgement-needed-over-tcp] This answers the question that there is a need for application level acknowledgement. I'm looking for the implementation. – krakers Oct 07 '18 at 15:49

1 Answers1

1

I can give you an example how it works for XMPP protocol.

Mobile apps use TCP as a transport for it, and there also could be some cases where messages are lost (e.g. issues with connectivity etc.)

So they came up with a separate XEP called Stream Management https://xmpp.org/extensions/xep-0198.html

Both parties exchange with additional simple packages: r and a. The full flow looks like the following:

<!-- User A sends a message to User B -->
<message from='userA@example.net/churchyard'
     to='userB@example.com'
     xml:lang='en'>
  <body>Hello</body>
</message>


<!-- then User A requests an acknowledgment from User B whether he received a message or not -->
<r xmlns='urn:xmpp:sm:3'/>

<!-- User B answeres with an acknowledgment package and a count how many packages he received -->
<a xmlns='urn:xmpp:sm:3' h='1'/>

So it's not any magical stuff here - it's just an additional data is exchanged to make sure it's all delivered properly. I guess you can follow a similar way.

Rubycon
  • 18,156
  • 10
  • 49
  • 70