14 lines
1.2 KiB
Markdown
14 lines
1.2 KiB
Markdown
|
<!--
|
||
|
SPDX-FileCopyrightText: © 2025 Hornwitser <code@hornwitser.no>
|
||
|
SPDX-License-Identifier: AGPL-3.0-or-later
|
||
|
-->
|
||
|
# Server-sent events
|
||
|
|
||
|
To update in real time this application sends a `text/event-source` stream using [Server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events). These streams use the current session if any to filter restricted resources and ends when the session expires, necessitating a reconnect by the user agent. (If there are no session associated with the connection it ends after the session expiry timeout).
|
||
|
|
||
|
## Events
|
||
|
|
||
|
Upon connecting a `"connect"` event is emitted with the session the connection was made under. This is the primary mechanism a user agent discovers its own session having been rotated into a new one, which also happens when the access level of the account associated with the session changes.
|
||
|
|
||
|
After the `"connect"` event the user agent will start to receive updates to resources it has access to that has changed. There is no filtering for what resoucres the user agent receives updates for at the moment as there's not enough events to justify the complexity of server-side subscriptions and filtering.
|