@prismshadow/penguin-library-trace · library/trace/src/history-stream.ts:50

LiveStreams

interface

What an HTTP stream is held against (packages/server http/sse.ts): the sign-in behind the connection. The library declares the mechanism; the registry is the server's (its LiveStreamRegistry). The pinned key keeps the table entry the server already published — a hot update from an earlier build compares revocations under the same name.

API

@Interface("@prismshadow/penguin-server#LiveStreams")
export abstract class LiveStreams {
  abstract add(userId: string, end: () => void): () => void;
  abstract endForUser(userId: string): number;
  abstract countFor(userId: string): number;
}

Contract Topology

Static AST wiring across @Module / @Provide / @Use

Members (3)

add

add(userId: string, end: () => void): () => void

Track a live stream for userId. The returned call removes it again and must run on every exit path of the connection — an entry left behind names a stream nobody can close, and its end would be called on a connection that is already gone.

@paramuserIdstring
@paramend() => void
@returns() => void

endForUser

endForUser(userId: string): number

End every stream this user is holding open; returns how many were ended.

@paramuserIdstring
@returnsnumber

countFor

countFor(userId: string): number

How many streams this user is holding open.

@paramuserIdstring
@returnsnumber