Options
All
  • Public
  • Public/Protected
  • All
Menu

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

  • T

Hierarchy

  • Stream

Index

Constructors

  • new Stream<T>(client: Client, topics: string[], decoder: MessageDecoder<T>, contentTopicUpdater?: ContentTopicUpdater<T>, onConnectionLost?: OnConnectionLostCallback): Stream<T>
  • Type parameters

    • T

    Parameters

    • client: Client
    • topics: string[]
    • decoder: MessageDecoder<T>
    • Optional contentTopicUpdater: ContentTopicUpdater<T>
    • Optional onConnectionLost: OnConnectionLostCallback

    Returns Stream<T>

Properties

callback: undefined | ((env: Envelope) => Promise<void>)
client: Client
messages: T[]
onConnectionLost?: OnConnectionLostCallback
resolvers: ((value: IteratorResult<T, any>) => void)[]
topics: string[]
unsubscribeFn?: UnsubscribeFn

Methods

  • [asyncIterator](): AsyncIterableIterator<T>
  • next(): Promise<IteratorResult<T, any>>
  • return(): Promise<IteratorResult<T, any>>
  • create<T>(client: Client, topics: string[], decoder: MessageDecoder<T>, contentTopicUpdater?: ContentTopicUpdater<T>, onConnectionLost?: OnConnectionLostCallback): Promise<Stream<T>>
  • Type parameters

    • T

    Parameters

    • client: Client
    • topics: string[]
    • decoder: MessageDecoder<T>
    • Optional contentTopicUpdater: ContentTopicUpdater<T>
    • Optional onConnectionLost: OnConnectionLostCallback

    Returns Promise<Stream<T>>

Generated using TypeDoc