Go to Latest
class ServerSentEventStreamTarget
extends EventTarget
import { ServerSentEventStreamTarget } from "https://dotland.deno.dev/std@0.181.0/http/server_sent_event.ts";

An implementation of ServerSentEventTarget that provides a readable stream as a body of a response to establish a connection to a client.

Constructors

new
ServerSentEventStreamTarget(unnamed 0?: ServerSentEventTargetOptions)

Properties

readonly
closed: boolean

Methods

asResponse(responseInit?: ResponseInit): Response

Returns a {@link Response} which contains the body and headers needed to initiate a SSE connection with the client.

asResponseInit(responseInit?: ResponseInit): [BodyInit, ResponseInit]

Returns a tuple which contains the {@link BodyInit} and {@link ResponseInit} needed to create a response that will establish a SSE connection with the client.

close(): Promise<void>
dispatchComment(comment: string): boolean
dispatchEvent(event: CloseEvent | ErrorEvent): boolean
dispatchMessage(data: any): boolean
[Symbol.for("Deno.customInspect")](inspect: (value: unknown) => string)
[Symbol.for("nodejs.util.inspect.custom")](
depth: number,
options: any,
inspect: (value: unknown, options?: unknown) => string,
)