class SseService
implements IService
Since 0.1.0

Implements IService.

Constructors

SseService(
options: SsePluginOptions | undefined,
runtime: IRuntimeServices,
backplane?: IRealtimeBackplane,
logger?: ILogger
)
Parameters
options: SsePluginOptions | undefined

Plugin options (heartbeatMs, retryMs); may be undefined

runtime: IRuntimeServices

Runtime services (injected from plugin registration)

optional
backplane: IRealtimeBackplane

Optional cross-replica transport. When present, every channel publish is also sent to it; when absent, channels stay purely in-process, which is the behavior before the backplane existed.

optional
logger: ILogger

Optional logger used to report a failed fan-out

Properties

readonly
channelCount: number

Number of channels the registry currently holds.

Rises for the life of a running application, since nothing reclaims a channel; SseService.closeAll discards them all at shutdown, which is the only thing that lowers it.

readonly
connectionCount: number

Current number of open connections.

Methods

channel(name: string): SseChannel

Return or create a named channel.

Since 0.1.0
closeAll(): void

Close all live connections (used during shutdown).

Since 0.2.0
deliverRemoteFrame(frame: RealtimeFrame): void

Delivers a message that arrived from another replica to this replica's local channel members.

Called only by the plugin's backplane subscription. It uses the registry's local-only delivery path, so an arriving message is never re-published — which would echo it around the cluster forever.

Frames of another kind, and frames this instance published itself, are ignored: one backplane topic carries both SSE channels and WebSocket rooms, and a channel may legitimately share a name with a room.

open(ctx: IRequestContext): ISseConnection

Open a new SSE connection for the given request context.

peek(name: string): SseChannel | undefined

Return the named channel if it already exists, without creating it.

Usage

import { SseService } from "sse-plugin/src/index.ts";