Who imports who · hover a nodeNo overview comment at the top of the file.
- Imports
- no other modules
- Used by
- 2 routes1 module1 other
Functions & values
Delivers the event to every live subscriber of the channels, once each even when listening on several.
export function publish(channels: string[], event: ServerEvent): void
Unit tests (6)
Yields the channels' events until the signal aborts (pending events dropped) or the consumer stops iterating.
export function subscribe(
channels: string[],
signal: AbortSignal,
): AsyncIterable<ServerEvent>
Unit tests (5)
Not shown, only used by tests: subscriberCount
No overview comment at the top of the file.
- Imports
- no other modules
- Used by
- 2 routes
Functions & values
Registers a live SSE connection so its topic set can be addressed by connection id.
export function register(connectionId: string, connection: SseConnection)
Removes a closed SSE connection from the registry.
export function unregister(connectionId: string)
Replaces the connection's topic set wholesale. Returns false when the user has no live connection with the given id.
export function replaceTopics(
connectionId: string,
userId: number,
topics: string[],
): boolean
No overview comment at the top of the file.
- Imports
- no other modules
- Used by
- 1 route
Functions & values
functioncanSubscribeToAll
:15 Whether the user may subscribe their SSE connection to every one of the topics. The user__ channel is never client-controllable.
export async function canSubscribeToAll(
userId: number,
topics: string[],
): Promise<boolean>
Unit tests (5)