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

msgid Support #571

Merged
merged 1 commit into from
Sep 17, 2024
Merged

msgid Support #571

merged 1 commit into from
Sep 17, 2024

Conversation

andymandias
Copy link
Collaborator

Support for message-ids.

First step in restructuring PR #370.

Copy link
Member

@tarkah tarkah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple enough!

We need to eventually handle outbound messages more gracefully, especially for servers that have echo-message so when supported we can:

  • Show messages as failed to send if they aren't echo'd within a timeout
  • Update our stored outbound message w/ the server chosen message id

We can use labeled-response as a way to match echo'd messages back to the original message we sent -> update it w/ server message id. If server doesn't support labeled-response but does support echo-message, we can use some timestamp / content comparison method I guess.

@andymandias
Copy link
Collaborator Author

Agreed re: outbound messages! The chathistory PR has changes to history that make the updating messages with their id clean & simple, so my inclination would be to wait for the history changes before implementing an id update for stored outbound messages. Detecting messages that fail to send, however, is not addressed at all by the chathistory PR.

@4e554c4c
Copy link
Contributor

4e554c4c commented Sep 17, 2024

We can use labeled-response as a way to match echo'd messages back to the original message we sent -> update it w/ server message id. If server doesn't support labeled-response but does support echo-message, we can use some timestamp / content comparison method I guess.

keeping track of messages with echo-message but not labeled-response is a bit tricky. a good reference IMO is how goguma does it: https://codeberg.org/emersion/goguma/src/commit/d26acea8416739cc962a3b3f05c4c7b148f4bb5d/lib/client.dart#L786
That is, keep track of how many messages are sent vs received. If both are the same then you're generally in sync.

If neither are available it does a PING/PONG after each message to make sure that the connection is still stable.

@andymandias andymandias merged commit ad6ccf9 into main Sep 17, 2024
1 check passed
@andymandias andymandias deleted the feat/msgid branch September 17, 2024 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants