Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Channel

Hierarchy

  • Channel

Index

Properties

id: number

The channel's id, this is supplied to us by the container

name?: string

The name of the channel.

service?: string

The name of the service associated with the channel.

status: "open" | "closed" | "closing"

The current connection status of the channel. When the channel is open or closing you can potentially receive commands on the channel. You can only send to the channel when it's open

Methods

  • onCommand(listener: (cmd: Command) => void): () => void
  • To listen to commands received by this channel, supply a a callback to this function and the callback will be called any time we receive a command on this channel.

    Parameters

    • listener: (cmd: Command) => void

      the command listener

        • (cmd: Command): void
        • Parameters

          • cmd: Command

          Returns void

    Returns () => void

    a function to stop listening

      • (): void
      • Returns void

  • Sends a command on the channel and returns a promise that is resolved when we get a response.

    Be ware, not all messages can have a result, so the promise might never resolve.

    Parameters

    • cmdJson: ICommand

      shape of a command see [[api.ICommand]]

    Returns Promise<RequestResult>

  • send(cmdJson: ICommand): void
  • Sends a command on the channel

    Parameters

    • cmdJson: ICommand

      shape of a command see [[api.ICommand]]

    Returns void

Generated using TypeDoc