matrix-org / matrix-org/matrix-js-sdk
Handle events from "initialSync" differently
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.2k
- Forks
- 704
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 40
Description
Is there a way to avoid differentiate events stemming from `matrixClient.startClient()` from other events? Specifically, I want to listen to "live events" to sometimes trigger application behavior when they come in.
However, I don't want the events from the initial sync to trigger that application behavior, since they are not "live".
I thought that `isInitialSyncComplete` would cover this use case, but if I understand the sequence correctly, `isInitialSyncComplete` is set independent of (typically before) the resulting events have been received.
I got things working "well enough" with this condition: `event.getLocalAge() > 5000` but it obviously relies on network conditions etc., so I was hoping to find a more fit for purpose solution using the SDK.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the event sequence around matrixClient.startClient() and isInitialSyncComplete, then compare it with the SDK's live-event handling. Define a fit-for-purpose way to distinguish initial-sync events from live events and verify that the distinction remains correct under varying network conditions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100