This repository has been archived on 2022-08-19. You can view files and clone it, but cannot push or open issues or pull requests.
hydrogen-web/doc/impl-thoughts/RECONNECTING.md

35 lines
1.1 KiB
Markdown
Raw Normal View History

# Reconnecting
2020-04-05 18:41:15 +05:30
`HomeServerApi` notifies `Reconnector` of network call failure
2020-04-05 18:41:15 +05:30
`Reconnector` listens for online/offline event
2020-04-05 18:41:15 +05:30
`Reconnector` polls `/versions` with a `RetryDelay` (implemented as ExponentialRetryDelay, also used by SendScheduler if no retry_after_ms is given)
2020-04-05 18:41:15 +05:30
`Reconnector` emits an event when sync and message sending should retry
2020-04-05 18:41:15 +05:30
`Sync` listen to `Reconnector`
`Sync` notifies when the catchup sync has happened
2020-04-05 18:41:15 +05:30
`Reconnector` has state:
- disconnected (and retrying at x seconds from timestamp)
- reconnecting (call /versions, and if successful /sync)
- connected
2020-04-05 18:41:15 +05:30
`Reconnector` 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)
2020-04-05 18:41:15 +05:30
`Session` listens to `Reconnector` to update it's status, but perhaps we wait to send messages until catchup sync is done