Skip to content

Commit

Permalink
Add fetching the well known in embedded mode. (#4259)
Browse files Browse the repository at this point in the history
* Add fetching the well known in embedded mode.

This is used to load the focus from the well known in elment-call.

* revert what we dont want in this PR.

* Update src/client.ts

Co-authored-by: Andrew Ferrazzutti <[email protected]>

---------

Co-authored-by: Andrew Ferrazzutti <[email protected]>
  • Loading branch information
toger5 and AndrewFerr authored Jun 26, 2024
1 parent 3e05a71 commit 0210106
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7410,7 +7410,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
return this.http.authedRequest(Method.Post, path, undefined, undefined, { prefix: "" });
}

private async fetchClientWellKnown(): Promise<void> {
protected async fetchClientWellKnown(): Promise<void> {
// `getRawClientConfig` does not throw or reject on network errors, instead
// it absorbs errors and returns `{}`.
this.clientWellKnownPromise = AutoDiscovery.getRawClientConfig(this.getDomain() ?? undefined);
Expand Down
8 changes: 8 additions & 0 deletions src/embedded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,14 @@ export class RoomWidgetClient extends MatrixClient {
});
}) ?? [],
);

if (opts.clientWellKnownPollPeriod !== undefined) {
this.clientWellKnownIntervalID = setInterval(() => {
this.fetchClientWellKnown();
}, 1000 * opts.clientWellKnownPollPeriod);
this.fetchClientWellKnown();
}

this.setSyncState(SyncState.Syncing);
logger.info("Finished backfilling events");

Expand Down

0 comments on commit 0210106

Please sign in to comment.