Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Stream<T, ClientType>

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

  • ClientType = any

Hierarchy

  • Stream

Index

Constructors

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

    • T

    • ClientType = any

    Parameters

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

    Returns Stream<T, ClientType>

Properties

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

Methods

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

    • T

    • ClientType = string

    Parameters

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

    Returns Promise<Stream<T, ClientType>>

Generated using TypeDoc