Skip to content
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

Handle messages not bridged #1

Closed
erdnaxeli opened this issue Aug 27, 2018 · 5 comments
Closed

Handle messages not bridged #1

erdnaxeli opened this issue Aug 27, 2018 · 5 comments
Labels
enhancement New feature or request

Comments

@erdnaxeli
Copy link

A common pitfall with matrix bridges is that your message is sent to matrix but not actually bridged to the third party network. It's a pitty, as you need to really trust the code but have no way to ensure your message is actually bridged. For example, I developed a stupid irc bot which just reply on message just to be able to test my IRC bridge instance.

This a complex problem that cannot be totally solved at the bridge level, but I think we could help a bit the user. Obviously we can just add some retry, but I don't think it's a good solution. Imagine this:

  • time X: I send a message A, which is not bridged due to some error
  • time X+1: A user from the third party network send a message B, which is correctly bridged
  • time X+2: After some retries, my message A is finally bridged

Now we are in the situation where from my side I see the message A then B, but the users on the third party network see B then A.

That's why I think the retry duration should be very short (something like one minute), and the retries should stop as soon as we receive a message from the third party network.

The thing is to notify the user that the message was not bridged. For this, I see two solution:

  1. The bridge's bot deletes the message from the matrix room, and notify the user in the admin room
  2. The bridge's bot reply to the message (using matrix replies), to warn the user "this message was not sended" (to distinguish bot's messages, notify may be used).

The solution 1 keeps a clean room's history , but is not very user friendly and force the user to go to another room to know what happened. The second solution would be more easier to understand by the user, but will add some garbage to the room's history.

https://github.com/tulir/mautrix-whatsapp/blob/2ec6ad242c2c03961aa689e01a24ab7970fd4279/portal.go#L788

@ptman
Copy link

ptman commented Aug 27, 2018

Reactions or some sort of annotations could maybe also be used: matrix-org/matrix-spec-proposals#441

@tulir
Copy link
Member

tulir commented Aug 28, 2018

Aggregations or custom EDUs would be nice as a "this message has been bridged" acknowledgement, but I'm guessing the spec/synapse impl will take quite a while still.

I think either the whatsapp web servers or go-whatsapp actually does retry sending if the phone is disconnected at the time. The bridge probably needs to handle cases where the connection fails completely (e.g. another web session is active)

@tulir tulir added the enhancement New feature or request label Aug 31, 2018
@krombel
Copy link
Contributor

krombel commented Sep 18, 2018

WhatsApp does not ensure the same order on all distributed devices. So the mentioned scenario occurs as well the case when $device is offline.
For the bridge I would therefore "just" implement some retry loop until the message got sent and don't bother with correct ordering

@erdnaxeli
Copy link
Author

erdnaxeli commented Sep 18, 2018

WhatsApp does not ensure the same order on all distributed devices. So the mentioned scenario occurs as well the case when $device is offline.

Yeah and I hate when it happens. It is a source of confusion in the discussion.

You need timeout. Retrying after some minutes is non sens imho.

tulir pushed a commit that referenced this issue Mar 13, 2019
Make sqlite and postgres more similar
tulir pushed a commit that referenced this issue May 16, 2019
Make sqlite and postgres more similar
@tulir
Copy link
Member

tulir commented May 21, 2020

I think I added messages corresponding to that error log at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

4 participants