Interface IStpConnector

STP connection interface

Hierarchy

  • IStpConnector

Implemented by

Properties

baseName?: string

Name of the service connected to STP

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

Type declaration

    • (error): void
    • Parameters

      • error: string

      Returns void

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

Type declaration

    • (message): void
    • Parameters

      • message: string

      Returns void

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

Type declaration

    • (message): string[]
    • Parameters

      • message: string

      Returns string[]

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

      Optional number of seconds to wait for a connection before failing

    • Optional machineId: null | string

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

    • Optional sessionId: null | 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>

    The actual sessionId used, which may be relevant if it was generated by the connector

  • 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