emulsion icon indicating copy to clipboard operation
emulsion copied to clipboard

Message enforcement architecture

Open ForNeVeR opened this issue 7 years ago • 0 comments

So, we want to always keep track of what we've sent to both of the chat rooms (XMPP and Telegram). Here I'll describe a general strategy, but it looks like it'll be most useful for XMPP (because the transport is extremely unreliable).

  1. When sending a message to the room, bot should also save that message to the internal storage.
  2. Before sending any additional messages to the same chat, bot should make sure the message it sent has been received. To do that, it just should listen for the room messages and await its' own response.
  3. If the response haven't been received after a timeout (say, 5 minutes), bot should then reconnect to the room (to make sure nothing's wrong with the connection), receive all the room messages through MAM, and then send the message again if it wasn't found in the full history archive.
  4. The bot internal storage should be persistent, so after reboot it still will try to deliver all the messages in the right order.

Yes, our bot should maintain a full history archive (as seen by the server through MAM) and that'll be additional challenge.

ForNeVeR avatar Dec 28 '17 15:12 ForNeVeR