Interface IStpConnector

STP connection interface

Hierarchy

  • IStpConnector

Implemented by

Properties

isConnected: boolean

True if the connection is open and capable of sending and receiving messages

name: undefined | string

Unique service instance name, different if there are concurrent instances running

onError: undefined | ((error) => void)

Event handler invoked when a connection error occurs

Param

Error description

onInform: undefined | ((message) => void)

Event handler invoked by STP when a message matching one of the Solvables is posted by some service

Param

STP API message to handle

onRequest: undefined | ((message) => string[])

Event handler invoked by STP when a service makes a request matching one of the Solvables

Param

STP API message to handle

Returns

STP API response

Methods

  • Connect and register the service, informing of the subscriptions it handles / consumes

    Parameters

    • serviceName: string

      Name of the service that is connecting

    • solvables: string[]

      Array of messages that this service handles

    • Optional timeout: number

      Number fo seconds to wait for a connection before failing

    • Optional machineId: string

      Optional machine Id to use. If not provided, it is set to some unique Id.

    • Optional sessionId: string

      Optional session Id to use. If not provided:

      1. the suffix to the WebSocket connection string is used
      2. if no WebSocket suffix was provided, the machineId is used.

    Returns Promise<undefined | string>

  • Disconnect from STP

    Parameters

    • Optional timeout: number

    Returns Promise<void>

  • Send a message/command to STP

    Parameters

    • message: string

      STP API message to send

    • Optional timeout: number

    Returns Promise<void>

  • Make a STP request - equivalent to an RPC call

    Parameters

    • message: string

      STP API message to send

    • Optional timeout: number

    Returns Promise<any>

    STP API responses

Generated using TypeDoc