Skip to content

@istock/iswork / Exports / MessageSSE

Class: MessageSSE

异步消息函数遍历处理机制

Implements

  • AbstractMessage<EventSource>

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new MessageSSE(options): MessageSSE

Parameters

NameType
optionsTMessageSSEOptions

Returns

MessageSSE

Defined in

src/packages/iswork/src/message/message-sse.ts:19

Properties

#onErrorCallback

Private #onErrorCallback: (event: MessageEvent<any>) => void

Type declaration

▸ (event): void

Parameters
NameType
eventMessageEvent<any>
Returns

void

Defined in

src/packages/iswork/src/message/message-sse.ts:18


#onMessageCallback

Private #onMessageCallback: (event: MessageEvent<any>) => void

Type declaration

▸ (event): void

Parameters
NameType
eventMessageEvent<any>
Returns

void

Defined in

src/packages/iswork/src/message/message-sse.ts:17


#options

Private Readonly #options: TMessageSSEOptions

Defined in

src/packages/iswork/src/message/message-sse.ts:16


instance

instance: EventSource

Implementation of

AbstractMessage.instance

Defined in

src/packages/iswork/src/message/message-sse.ts:15

Methods

#messageAsyncGenerator

#messageAsyncGenerator(): AsyncGenerator<TMessageSSEIteratorData, void, unknown>

异步消息生成器函数

Returns

AsyncGenerator<TMessageSSEIteratorData, void, unknown>

Defined in

src/packages/iswork/src/message/message-sse.ts:70


close

close(): Promise<void>

Returns

Promise<void>

Implementation of

AbstractMessage.close

Defined in

src/packages/iswork/src/message/message-sse.ts:31


onClose

onClose(): Promise<void>

Returns

Promise<void>

Defined in

src/packages/iswork/src/message/message-sse.ts:61


onError

onError(callback): Promise<void>

Parameters

NameType
callback(error: Error, event: MessageEvent<any>) => Promise<void>

Returns

Promise<void>

Implementation of

AbstractMessage.onError

Defined in

src/packages/iswork/src/message/message-sse.ts:52


onMessage

onMessage(callback): Promise<void>

Parameters

NameType
callback(message: any) => Promise<void>

Returns

Promise<void>

Implementation of

AbstractMessage.onMessage

Defined in

src/packages/iswork/src/message/message-sse.ts:43


open

open(): Promise<void>

Returns

Promise<void>

Implementation of

AbstractMessage.open

Defined in

src/packages/iswork/src/message/message-sse.ts:24


send

send(message): Promise<void>

Parameters

NameType
messageany

Returns

Promise<void>

Implementation of

AbstractMessage.send

Defined in

src/packages/iswork/src/message/message-sse.ts:36


create

create(optoins): Promise<AsyncIterator<TMessageSSEIteratorData, void, unknown>>

创建一个Generator异步消息函数

Parameters

NameType
optoinsTMessageSSEOptions

Returns

Promise<AsyncIterator<TMessageSSEIteratorData, void, unknown>>

Defined in

src/packages/iswork/src/message/message-sse.ts:99

免责声明:本站所有信息、数据、软件仅供学习研究,都不构成投资建议,本站不承担由此导致的任何责任。