From 65cca83f7fceb3094a2676384566d2d8ce2016dd Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 30 Mar 2020 22:24:38 +0200 Subject: [PATCH] notes how to implement reconnecting and status reporting --- doc/impl-thoughts/RECONNECTING.md | 35 ++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/doc/impl-thoughts/RECONNECTING.md b/doc/impl-thoughts/RECONNECTING.md index fb9ff506..f818b6fc 100644 --- a/doc/impl-thoughts/RECONNECTING.md +++ b/doc/impl-thoughts/RECONNECTING.md @@ -1 +1,34 @@ -# Reconnecting \ No newline at end of file +# Reconnecting + +`HomeServerApi` notifies `Reconnecter` of network call failure + +`Reconnecter` listens for online/offline event + +`Reconnecter` polls `/versions` with a `RetryDelay` (implemented as ExponentialRetryDelay, also used by SendScheduler if no retry_after_ms is given) + +`Reconnecter` emits an event when sync and message sending should retry + +`Sync` listen to `Reconnecter` +`Sync` notifies when the catchup sync has happened + +`Reconnecter` has state: + - disconnected (and retrying at x seconds from timestamp) + - reconnecting (call /versions, and if successful /sync) + - connected + +`Reconnecter` has a method to try to connect now + +`SessionStatus` can be: + - disconnected (and retrying at x seconds from timestamp) + - reconnecting + - connected (and syncing) + + - doing catchup sync + - sending x / y messages + +rooms should report how many messages they have queued up, and each time they sent one? + +`SendReporter` (passed from `Session` to `Room`, passed down to `SendQueue`), with: + - setPendingEventCount(roomId, count) + +`Session` listens to `Reconnecter` to update it's status, but perhaps we wait to send messages until catchup sync is done