Stream
Class: Stream<T>
Stream implements an Asynchronous Iterable over messages received from a topic. As such can be used with constructs like for-await-of, yield*, array destructing, etc.
Type parameters
Name |
---|
T |
Constructors
constructor
new Stream<T
>(client
, topics
, decoder
, contentTopicUpdater?
)
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
client | Client |
topics | string [] |
decoder | MessageDecoder <T > |
contentTopicUpdater? | ContentTopicUpdater <T > |
Defined in
Properties
callback
callback: undefined
| (env
: Envelope
) => Promise
<void
>
Defined in
client
client: Client
Defined in
messages
messages: T
[]
Defined in
resolvers
resolvers: (value
: IteratorResult
<T
, any
>) => void
[]
Defined in
topics
topics: string
[]
Defined in
unsubscribeFn
Optional
unsubscribeFn: UnsubscribeFn
Defined in
Methods
[asyncIterator]
[asyncIterator](): AsyncIterableIterator
<T
>
Returns
AsyncIterableIterator
<T
>
Defined in
newMessageCallback
Private
newMessageCallback(decoder
, contentTopicUpdater?
): (env
: Envelope
) => Promise
<void
>
Parameters
Name | Type |
---|---|
decoder | MessageDecoder <T > |
contentTopicUpdater? | ContentTopicUpdater <T > |
Returns
fn
(env
): Promise
<void
>
Parameters
Name | Type |
---|---|
env | Envelope |
Returns
Promise
<void
>
Defined in
next
next(): Promise
<IteratorResult
<T
, any
>>
Returns
Promise
<IteratorResult
<T
, any
>>
Defined in
resubscribeToTopics
Private
resubscribeToTopics(topics
): Promise
<void
>
Parameters
Name | Type |
---|---|
topics | string [] |
Returns
Promise
<void
>
Defined in
return
return(): Promise
<IteratorResult
<T
, any
>>
Returns
Promise
<IteratorResult
<T
, any
>>
Defined in
start
Private
start(): Promise
<void
>
Returns
Promise
<void
>
Defined in
create
Static
create<T
>(client
, topics
, decoder
, contentTopicUpdater?
): Promise
<Stream
<T
>>
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
client | Client |
topics | string [] |
decoder | MessageDecoder <T > |
contentTopicUpdater? | ContentTopicUpdater <T > |
Returns
Promise
<Stream
<T
>>