review andrewF

Signed-off-by: Timo K <toger5@hotmail.de>
toger5/expiring-events-keep-alive
Timo K 2 years ago
parent 8ec637418a
commit 9f45cfa62b

@ -19,12 +19,12 @@ time window after a user disconnected.
## Proposal ## Proposal
Events can contain a `m.will_expire: "running" | "expired" | "ended"` field. Events can contain a `"m.will_expire": "running" | "expired" | "ended"` field.
This is an enum marking the event as This is marking the event as expired `"m.will_expire": "expired" | "ended"` or as
expired `m.will_expire: "expired" | "ended"` or still alive `m.will_expire: "running"`. still alive `"m.will_expire": "running"`.
This field lives outside the ciphertext content (hence it also works for encrypted This field lives outside the ciphertext content (hence it also works for encrypted
events) and is set via the usual `PUT` request if the content contains the additional events) and is set via the usual `PUT` request if the content contains the additional
`m.will_expire: 10` field (similar how it is done with relations), with the desired `"m.will_expire": 10` field (similar how it is done with relations), with the desired
timeout duration in seconds. timeout duration in seconds.
Request Request
@ -36,7 +36,7 @@ Request
} }
``` ```
If the homeserver detects a `m.expired` field it will store and distribute the If the homeserver detects a `m.will_expire` field it will store and distribute the
event as hiding the timeout duration: event as hiding the timeout duration:
```json ```json
@ -53,8 +53,8 @@ The response to the client will be:
```json ```json
{ {
"eventId": "hash_id", "eventId": "id_hash",
"expire_refresh_token": "hash_refresh", "expire_refresh_token": "refresh_hash",
} }
``` ```
@ -62,34 +62,34 @@ The default response is extended with the `expire_refresh_token` which
can be used to reset the expiration timeout (in this example 10 seconds). can be used to reset the expiration timeout (in this example 10 seconds).
A new unauthenticated endpoint is introduced: A new unauthenticated endpoint is introduced:
`PUT /_matrix/client/v3/expiration/{refresh_method}` `PUT /_matrix/client/v3/expiration/{refresh_method}`
where the `refresh_method` is either: `refresh`, `end` where the `refresh_method` is one of: `[refresh, end]`
The body contains the refresh token so the homeserver knows what to refresh. The body contains the refresh token so the homeserver knows what to refresh.
```json ```json
{ {
"expire_refresh_token": "hash_refresh", "expire_refresh_token": "refresh_hash",
} }
``` ```
The information required to call this endpoint is very limited so that almost The information required to call this endpoint is very limited so that almost
no metadata is leaked when. This allows to share a refresh link to a different no metadata is leaked. This allows to share a refresh link to a different
service (an SFU for instance) that can track the current client connection state, service (an SFU for instance) that can track the current client connection state,
and pings the HS to refresh and informs the HS about a disconnect. and pings the HS to refresh and informs the HS about a disconnect.
The homeserver does the following when receiving an event with `m.expired` The homeserver does the following when receiving an event with `m.will_expire`
- It generates a token and stores it alongside with the time of retrieval, - It generates a token and stores it alongside with the time of retrieval,
the eventId and the expire duration. the eventId and the expire duration.
- Starts a counter for the stored expiation token. - Starts a timer for the stored expiration token.
- If a `PUT /_matrix/client/v3/expiration/refresh` is received, the - If a `PUT /_matrix/client/v3/expiration/refresh` is received, the
timer is restarted with the stored expire duration. timer is restarted with the stored expire duration.
- If a `PUT /_matrix/client/v3/expiration/end` is received, the - If a `PUT /_matrix/client/v3/expiration/end` is received, the
event _gets ended_. event _gets ended_.
- If the timer times out, the event _gets expired_. - If the timer times out, the event _gets expired_.
- If the event is a state event only the latest/current state is considered. If - If the event is a state event only the latest/current state is considered. If
the homeserver receives a new state event without `m.expires` but with the same the homeserver receives a new state event without `m.will_expire` but with the
state key, the expire_refresh_token gets invalidated and the associated timer is same state key, the expire_refresh_token gets invalidated and the associated timer
stopped. is stopped.
The event _gets expired_/_gets ended_ means: The event _gets expired_/_gets ended_ means:

Loading…
Cancel
Save