Skip to content

Class: EventStream ​

Defined in: api/rust-fetch.d.ts:748

A Server-Sent Events stream created by WasmClient.events(); also an async iterator of events

Properties ​

closed ​

readonly closed: Promise<void>

Defined in: api/rust-fetch.d.ts:768

Resolves once the stream is closed for good


lastEventId ​

readonly lastEventId: string

Defined in: api/rust-fetch.d.ts:772

The last event ID received, sent as Last-Event-ID when reconnecting


opened ​

readonly opened: Promise<void>

Defined in: api/rust-fetch.d.ts:776

Resolves when the first connection opens; rejects if it never does


state ​

readonly state: EventStreamState

Defined in: api/rust-fetch.d.ts:780

connecting, open, reconnecting or closed


url ​

readonly url: string

Defined in: api/rust-fetch.d.ts:784

The stream's URL, resolved against the client's base URL

Methods ​

[asyncIterator]() ​

[asyncIterator](): AsyncIterator<ServerSentEvent<any>>

Defined in: api/rust-fetch.d.ts:752

Returns ​

AsyncIterator<ServerSentEvent<any>>


[dispose]() ​

[dispose](): void

Defined in: api/rust-fetch.d.ts:751

Returns ​

void


close() ​

close(): void

Defined in: api/rust-fetch.d.ts:756

Close the stream and stop reconnecting

Returns ​

void


free() ​

free(): void

Defined in: api/rust-fetch.d.ts:750

Returns ​

void


next() ​

next(): Promise<IteratorResult<ServerSentEvent<any>, any>>

Defined in: api/rust-fetch.d.ts:760

The next buffered event (async iterator protocol)

Returns ​

Promise<IteratorResult<ServerSentEvent<any>, any>>


return() ​

return(): Promise<IteratorResult<ServerSentEvent<any>, any>>

Defined in: api/rust-fetch.d.ts:764

Stop iterating: closes the stream (async iterator protocol, e.g. break)

Returns ​

Promise<IteratorResult<ServerSentEvent<any>, any>>

Released under the MIT or Apache-2.0 license.