Defines MQTT transport options for a VDA 5050 client.

Hierarchy

  • MqttTransportOptions

Properties

brokerUrl: string

Connection URL to MQTT broker (schema protocol://host:port, e.g. mqtt://localhost:1883).

Supported protocols include mqtt, mqtts, tcp, tls, ws, wss, wx, wxs (WeChat Mini), ali, alis (Ali Mini).

Remarks

You can also specify mqtt or mqtts if the client runs in a browser to open a (secure) websocket connection.

connectTimeout?: number

Time in milliseconds to wait for a connection acknowledgement message from the broker (optional).

Defaults to 30000 ms. If no CONNACK is received within the given time, the connection is aborted.

heartbeat?: number

Heartbeat interval in seconds for exchanging keep alive messages between MQTT broker and client (optional).

Defaults to 15 seconds (as recommended by VDA 5050 specification); set to 0 to disable.

password?: string

The password required by your MQTT broker (optional).

protocolVersion?: "3.1.1" | "5.0"

The MQTT protocol version used to connect to the broker (optional).

If not specified, value defaults to "3.1.1".

reconnectPeriod?: number

Interval in milliseconds between two reconnection attempts (optional).

Defaults to 1000 ms. Disable auto reconnect by setting to 0.

tlsOptions?: {
    ca?: string | string[] | Buffer | Buffer[];
    cert?: string | string[] | Buffer | Buffer[];
    key?: string | string[] | Buffer | {
        passphrase?: string;
        pem: string | Buffer;
    }[] | Buffer[];
    passphrase?: string;
    pfx?: string | string[] | Buffer | Buffer[] | {
        buf: string | Buffer;
        passphrase?: string;
    }[];
    rejectUnauthorized?: boolean;
    [option: string]: any;
}

Connection options for mqtts - MQTT over TLS (optional).

Default is {}. Options are passed through to tls.connect().

Remarks

If you run your MQTT connection over WebSockets, use wsOptions instead.

Type declaration

  • [option: string]: any
  • Optional ca?: string | string[] | Buffer | Buffer[]

    Optionally override the trusted CA certificates in PEM format (optional).

  • Optional cert?: string | string[] | Buffer | Buffer[]

    Cert chains in PEM format (optional).

  • Optional key?: string | string[] | Buffer | {
        passphrase?: string;
        pem: string | Buffer;
    }[] | Buffer[]

    Private keys in PEM format (optional).

  • Optional passphrase?: string

    Shared passphrase used for a single private key and/or a PFX.

  • Optional pfx?: string | string[] | Buffer | Buffer[] | {
        buf: string | Buffer;
        passphrase?: string;
    }[]

    PFX or PKCS12 encoded private key and certificate chain. pfx is an alternative to providing key and cert individually. PFX is usually encrypted, if it is, passphrase will be used to decrypt it.

  • Optional rejectUnauthorized?: boolean

    If not false, the server certificate is verified against the list of supplied CAs (optional). Defaults to true.

    Remarks

    If you are using a self-signed certificate, additionally pass the rejectUnauthorized: false option. Beware that you are exposing yourself to man in the middle attacks, so it is a configuration that should never be used for production environments.

topicFormat?: string

Defines the MQTT topic structure as a formatted string with placeholders according to the VDA 5050 protocol specification (optional).

Used to create MQTT topics for publication and subscription based on the following format specifiers:

  • %interfaceName% - Name of the used interface
  • %majorVersion% - Major version number prepended by a "v"
  • %manufacturer% - Manufacturer of the AGV (e.g. RobotCompany)
  • %serialNumber% - Unique AGV Serial Number consisting of the following characters: A-Z a-z 0-9 _ . : -
  • %topic% - VDA 5050 subtopic name (see enum Topic)

Remarks

The MQTT topic structure is not strictly defined to support a mandatory topic structure of cloud-based MQTT brokers. While the %topic% placeholder must be present in any case the other ones may be omitted.

Note that any of the defined placeholders must always make up a complete MQTT topic level.

If this option is not specified, the default format looks like this: %interfaceName%/%majorVersion%/%manufacturer%/%serialNumber%/%topic%

Example: uagv/v2/KIT/0001/order

transformWsUrl?: ((url: string, options: any, client: any) => string)

Type declaration

    • (url: string, options: any, client: any): string
    • For WebSocket ws/wss protocols only (optional). Can be used to implement signing urls or authentication options which upon reconnect can have become expired.

      For details, see here.

      Parameters

      • url: string
      • options: any
      • client: any

      Returns string

username?: string

The username required by your MQTT broker (optional).

wsOptions?: object

WebSocket specific connection options (optional).

Default is {}. Only used for WebSocket connections.

For possible options have a look at: https://github.com/websockets/ws/blob/master/doc/ws.md.

Generated using TypeDoc