Sse
Constructors
Signature
declare const encoder: EncodermakeChannel
Added in v1.0.0
Source
Signature
declare function makeChannel<IE, Done>(options?: DecodeOptions & { readonly bufferSize?: number;}): Channel<Chunk<Event>, Chunk<string>, IE, IE, void, Done>makeParser
Added in v1.0.0
Source
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 function makeParser(onParse: (event: AnyEvent) => void, options?: DecodeOptions): ParserErrors
EventTooLarge
Added in v1.0.0
Source
Signature
declare class EventTooLarge extends YieldableError<this> & { readonly _tag: "EventTooLarge";} & Readonly<{ readonly maxEventSize: number;}> { constructor(args: { readonly maxEventSize: number; }); message: string;}Signature
declare class SseError extends YieldableError<this> & { readonly _tag: "SseError";} & Readonly<{ readonly cause: EventTooLarge;}> { constructor(args: { readonly cause: EventTooLarge; }); readonly "@effect/experimental/Sse/SseError": "@effect/experimental/Sse/SseError"; message: string;}SseErrorReason type
Added in v1.0.0
Source
Signature
type SseErrorReason = EventTooLargeModels
Signature
type AnyEvent = Event | RetryDecodeOptions interface
Added in v1.0.0
Source
Signature
interface DecodeOptions { readonly maxEventSize?: number;}Signature
interface Encoder { write(event: AnyEvent): string;}Signature
interface Event { readonly _tag: "Event"; readonly data: string; readonly event: string; readonly id: string | undefined;}EventEncoded interface
Added in v1.0.0
Source
Signature
interface EventEncoded { readonly data: string; readonly event: string; readonly id: string | undefined;}Signature
interface Parser { feed(chunk: string): SseError | undefined; reset(): void;}Signature
declare class Retry extends Readonly<{ readonly duration: Duration; readonly lastEventId: string | undefined;}> & { readonly _tag: "Retry";} & Pipeable { constructor(args: { readonly duration: Duration; readonly lastEventId: string | undefined; }); readonly [RetryTypeId]: typeof RetryTypeId; static is(u: unknown): u is Retry;}Type Ids
RetryTypeId
Added in v1.0.0
Source
Signature
declare const RetryTypeId: unique symbolRetryTypeId type
Added in v1.0.0
Source
Signature
type RetryTypeId = typeof RetryTypeId