-
-
Notifications
You must be signed in to change notification settings - Fork 79
Add MSC4357 live messaging support #517
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
base: main
Are you sure you want to change the base?
Conversation
I'll double check this at weekends |
The notification handler should be modified to exclude live messages. And can't most of the new logic in |
Fixed! I've added a check to skip notifications for live messages in the notification handler. I didn't catch this during testing because I had notifications disabled in my iamb client. The handler now filters out any events with the
I looked into using bundled relations but couldn't find them exposed through the current SDK interface. The events come through as |
7de4ff0
to
3516f12
Compare
Live messages (MSC4357) are now filtered out in the notification handler to prevent notifications for incomplete messages that are still being typed. This fixes the issue where users would receive notifications for messages with just a few letters. Also simplified the worker.rs load_insert logic by clarifying comments and relying on the centralized live detection.
3516f12
to
af6994f
Compare
There is If we can use this, we could filter edits events from the message load to preserve bandwidth and increase load times. With live messages there would be more edit events in the history and only the newest one is important anyway. |
Thanks for pointing me in the right direction! I investigated this further and you're absolutely right - the server does send bundled relations in The good news is that for unencrypted rooms, the bundled relations contain the full content of the latest edit, which we could definitely use to skip loading intermediate edits. This would be especially helpful for live messages since they may generate so many edits. The bad news is that for encrypted rooms, the bundled relations only contain the encrypted ciphertext. Makes sense when you think about it - the server can't aggregate content it can't decrypt, so this optimization wouldn't work for E2E encrypted rooms. There's also a minor SDK limitation - after deserializing to If you think it's worth it, I could implement this optimization for unencrypted rooms. I'll check for bundled relations in the raw event, track which events already have the latest content bundled, and skip loading the intermediate edits that are superseded. For original messages with bundled edits, we'd apply that content directly instead of waiting for the separate edit events. |
Could we use
It is your PR and I'm not a maintainer so that is your decision. |
Since messages come in reverse chronological order, the first edit we encounter is the latest. This commit: - Tracks which edits we've already seen the latest version of - Skips loading older edits when we already have a newer one - Skips edits for messages that have bundled replacements - Significantly reduces the number of events to process, especially for live messages This optimization works for both encrypted and unencrypted rooms, as we're just filtering duplicate edits regardless of content.
Since messages come in reverse chronological order, the first edit we encounter is the latest. This commit:
This optimization works for both encrypted and unencrypted rooms, as we're just filtering duplicate edits regardless of content. |
Implements MSC4357 live messaging protocol for real-time message composition in iamb. Messages appear gray while being typed and update in real-time for all room participants.
Features
/live <message>
command to compose messages that update as you typeImplementation Details
org.matrix.msc4357.live
marker in message JSONLiveMessageManager
tracks active live sessions per roomBug Fixes
Changes
src/message/live.rs
- Core live messaging functionalitysrc/message/live_detection.rs
- Centralized marker detection/live
command and send updatesv02.mov