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

    STP connection interface

    interface IStpConnector {
        baseName?: string;
        isConnected: boolean;
        name: string | undefined;
        onError: ((error: string) => void) | undefined;
        onInform: ((message: string) => void) | undefined;
        onRequest: ((message: string) => string[]) | undefined;
        connect(
            serviceName: string,
            solvables: string[],
            timeout?: number,
            machineId?: string | null,
            sessionId?: string | null,
        ): Promise<string | undefined>;
        disconnect(timeout?: number): Promise<void>;
        inform(message: string, timeout?: number): Promise<void>;
        request(message: string, timeout?: number): Promise<any>;
    }

    Implemented by

    Index

    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: 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

    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

      • Optionaltimeout: number

        Optional number of seconds to wait for a connection before failing

      • OptionalmachineId: string | null

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

      • OptionalsessionId: string | 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.

      Returns Promise<string | undefined>

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

    • Disconnect from STP

      Parameters

      • Optionaltimeout: number

      Returns Promise<void>

    • Send a message/command to STP

      Parameters

      • message: string

        STP API message to send

      • Optionaltimeout: number

      Returns Promise<void>

    • Make a STP request - equivalent to an RPC call

      Parameters

      • message: string

        STP API message to send

      • Optionaltimeout: number

      Returns Promise<any>

      STP API responses