Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fathym_common/src/src.deps.ts>ServerSentEventStream

The Fathym Reference Architecture provides the common foundation for applications built in Typescript.
Go to Latest
class ServerSentEventStream
import { ServerSentEventStream } from "https://deno.land/x/fathym_common@v0.0.158/src/src.deps.ts";

Transforms server-sent message objects into strings for the client.

Examples

Example 1

import {
  type ServerSentEventMessage,
  ServerSentEventStream,
} from "https://deno.land/std@0.224.0/http/server_sent_event_stream.ts";

const stream = ReadableStream.from<ServerSentEventMessage>([
  { data: "hello there" }
]).pipeThrough(new ServerSentEventStream());
new Response(stream, {
  headers: {
    "content-type": "text/event-stream",
    "cache-control": "no-cache",
  },
});

Constructors

new
ServerSentEventStream()