Sse.ts overview
Since v1.0.0
Exports Grouped by Category
constructors
encoder
Signature
declare const encoder: Encoder
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>
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
Since v1.0.0
errors
EventTooLarge (class)
Signature
declare class EventTooLarge
Since v1.0.0
SseError (class)
Signature
declare class SseError
Since v1.0.0
[SseErrorTypeId] (property)
Signature
readonly [SseErrorTypeId]: "@effect/experimental/Sse/SseError"
SseErrorReason (type alias)
Signature
type SseErrorReason = EventTooLarge
Since v1.0.0
models
AnyEvent (type alias)
Signature
type AnyEvent = Event | Retry
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
}
Since v1.0.0
Encoder (interface)
Signature
export interface Encoder {
write(event: AnyEvent): string
}
Since v1.0.0
Event (interface)
Signature
export interface Event {
readonly _tag: "Event"
readonly event: string
readonly id: string | undefined
readonly data: string
}
Since v1.0.0
EventEncoded (interface)
Signature
export interface EventEncoded {
readonly event: string
readonly id: string | undefined
readonly data: string
}
Since v1.0.0
Parser (interface)
Signature
export interface Parser {
feed(chunk: string): SseError | undefined
reset(): void
}
Since v1.0.0
Retry (class)
Signature
declare class Retry
Since v1.0.0
is (static method)
Signature
declare const is: (u: unknown) => u is Retry
Since v1.0.0
[RetryTypeId] (property)
Signature
readonly [RetryTypeId]: unique symbol
Since v1.0.0
type ids
RetryTypeId
Signature
declare const RetryTypeId: unique symbol
Since v1.0.0
RetryTypeId (type alias)
Signature
type RetryTypeId = typeof RetryTypeId
Since v1.0.0