matrix-org / matrix-org/matrix-js-sdk

Handle events from "initialSync" differently

Open
#3,476 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.