Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface GraphqlStreamClient

The stream client is an interface used to interact with dfuse Stream API.

The stream client interface shall be responsible of managing the registration unregistration of the dfuse Stream as well as managing the full lifecycle of a dfuse Stream currently active.

group

Interfaces

Hierarchy

  • GraphqlStreamClient

Index

Methods

registerStream

  • Register a dfuse Stream with the remote endpoint and receives message back from the stream via the onMessage parameter.

    By calling this method, the socket will connect to remote endpoint if it's not already the case. As soon as the method is called, the specific dfuse Stream listening message is send to remote endpoint.

    On success, you will receive a Stream interface that you can use to interact with the stream (mark progeess, restart, close).

    On error, the promise will reject with the actual error thrown.

    Type parameters

    • T = unknown

    Parameters

    Returns Promise<Stream>

release

  • release(): void

setApiToken

  • setApiToken(apiToken: string): void
  • Update the API token that should be used to communicate with the dfuse Stream API. This token is assumed to be fresh and valid.

    Parameters

    • apiToken: string

      The new API token to use from now on.

    Returns void

unregisterStream

  • unregisterStream(id: string): Promise<void>
  • Unregister the stream represented by this stream's id.

    This will send the stop message to the remote endpoint effectively stopping the dfuse GraphQL Subscription as well as the flow of message.

    All stream should be unregistered when not required anymore to clean up resources and ensure no more extra bandwidth are required.

    Parameters

    • id: string

      The stream's id that should be unregister from the stream client.

    Returns Promise<void>

Generated using TypeDoc