EventStreamContext
@tsed/sse
Usage
typescript
import { EventStreamContext } from "@tsed/sse";
See /packages/third-parties/sse/src/types/domain/EventStreamContext.ts.
Overview
ts
class EventStreamContext {
constructor({ $ctx, ...opts }: EventStreamContextOptions);
writeHead(headers?: Record<string, string>): void;
on(event: string, listener: (...args: any[]) => void): this;
subscribe(observable: Observable<unknown>): this;
stream(stream: NodeJS.ReadableStream | EventEmitter): void;
emit(event: string | undefined, data: unknown): this | undefined;
write(obj: Record<string, string>): void;
isDone(): boolean;
end(): void;
}
writeHead
ts
writeHead(headers?: Record<string, string>): void;
on
ts
on(event: string, listener: (...args: any[]) => void): this;
subscribe
ts
subscribe(observable: Observable<unknown>): this;
stream
ts
stream(stream: NodeJS.ReadableStream | EventEmitter): void;
emit
ts
emit(event: string | undefined, data: unknown): this | undefined;
write
ts
write(obj: Record<string, string>): void;
isDone
ts
isDone(): boolean;
end
ts
end(): void;