Skip to main content Link Search Menu Expand Document (external link)

Sse.ts overview

Since v1.0.0


Exports Grouped by Category


constructors

encoder

Signature

declare const encoder: Encoder

Source

Since v1.0.0

makeChannel

Signature

declare const makeChannel: <IE, Done>(
  options?: DecodeOptions & { readonly bufferSize?: number }
) => Channel.Channel<Chunk.Chunk<Event>, Chunk.Chunk<string>, IE, IE, void, Done>

Source

Since v1.0.0

makeParser

Create a SSE parser.

Adapted from https://github.com/rexxars/eventsource-parser under MIT license. feed returns an SseError if the pending event exceeds maxEventSize.

Signature

declare const makeParser: (onParse: (event: AnyEvent) => void, options?: DecodeOptions) => Parser

Source

Since v1.0.0

errors

EventTooLarge (class)

Signature

declare class EventTooLarge

Source

Since v1.0.0

SseError (class)

Signature

declare class SseError

Source

Since v1.0.0

[SseErrorTypeId] (property)

Signature

readonly [SseErrorTypeId]: "@effect/experimental/Sse/SseError"

Source

SseErrorReason (type alias)

Signature

type SseErrorReason = EventTooLarge

Source

Since v1.0.0

models

AnyEvent (type alias)

Signature

type AnyEvent = Event | Retry

Source

Since v1.0.0

DecodeOptions (interface)

Signature

export interface DecodeOptions {
  /**
   * Maximum number of string code units retained for a pending event. The default is 10 MiB.
   */
  readonly maxEventSize?: number | undefined
}

Source

Since v1.0.0

Encoder (interface)

Signature

export interface Encoder {
  write(event: AnyEvent): string
}

Source

Since v1.0.0

Event (interface)

Signature

export interface Event {
  readonly _tag: "Event"
  readonly event: string
  readonly id: string | undefined
  readonly data: string
}

Source

Since v1.0.0

EventEncoded (interface)

Signature

export interface EventEncoded {
  readonly event: string
  readonly id: string | undefined
  readonly data: string
}

Source

Since v1.0.0

Parser (interface)

Signature

export interface Parser {
  feed(chunk: string): SseError | undefined
  reset(): void
}

Source

Since v1.0.0

Retry (class)

Signature

declare class Retry

Source

Since v1.0.0

is (static method)

Signature

declare const is: (u: unknown) => u is Retry

Source

Since v1.0.0

[RetryTypeId] (property)

Signature

readonly [RetryTypeId]: unique symbol

Source

Since v1.0.0

type ids

RetryTypeId

Signature

declare const RetryTypeId: unique symbol

Source

Since v1.0.0

RetryTypeId (type alias)

Signature

type RetryTypeId = typeof RetryTypeId

Source

Since v1.0.0