Sketch-thru-Plan Websockets Connector
    Preparing search index...

    Implements a connector to STP's native OAA pub/sub service via WebSockets

    Implements

    Index

    Constructors

    Properties

    connstring: string
    DEFAULT_TIMEOUT: number = 30
    machineId: string | undefined
    name: string | undefined

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

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

    Event handler invoked when a connection error occurs

    Error description

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

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

    STP API message to handle

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

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

    STP API message to handle

    STP API response

    serviceName: string | undefined
    sessionId: string | undefined
    socket: WebSocket | null
    solvables: string[] | undefined
    timeout: number | undefined

    Accessors

    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

      • timeout: number = ...

        Optional number of seconds to wait for a connection before failing

      • machineId: string | null = null

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

      • sessionId: string | null = null

        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
        3. If machineId is not provided, a unique random Id is used.

      Returns Promise<string | undefined>

      The actual sessionId used - the one provided here or a default set by STP