Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AwsIotMqttConnectionConfigBuilder

Builder functions to create a MqttConnectionConfig which can then be used to create a MqttClientConnection, configured for use with AWS IoT.

Hierarchy

  • AwsIotMqttConnectionConfigBuilder

Index

Methods

build

  • Returns the configured MqttConnectionConfig

    Returns MqttConnectionConfig

    The configured MqttConnectionConfig

with_certificate_authority

  • with_certificate_authority(ca: string): this
  • Overrides the default system trust store.

    Parameters

    • ca: string

      Buffer containing all trust CAs, in PEM format

    Returns this

with_certificate_authority_from_path

  • with_certificate_authority_from_path(ca_dirpath?: string, ca_filepath?: string): this
  • Overrides the default system trust store.

    Parameters

    • Optional ca_dirpath: string

      Only used on Unix-style systems where all trust anchors are stored in a directory (e.g. /etc/ssl/certs).

    • Optional ca_filepath: string

      Single file containing all trust CAs, in PEM format

    Returns this

with_clean_session

  • with_clean_session(clean_session: boolean): this
  • Determines whether or not the service should try to resume prior subscriptions, if it has any

    Parameters

    • clean_session: boolean

      true if the session should drop prior subscriptions when this client connects, false to resume the session

    Returns this

with_client_id

  • with_client_id(client_id: string): this
  • Configures the client_id to use to connect to the IoT Core service

    Parameters

    • client_id: string

      The client id for this connection. Needs to be unique across all devices/clients.

    Returns this

with_credentials

  • Configures AWS credentials (usually from Cognito) for this connection

    Parameters

    • aws_region: string

      The service region to connect to

    • aws_access_id: string

      IAM Access ID

    • aws_secret_key: string

      IAM Secret Key

    • Optional aws_sts_token: string

      STS token from Cognito (optional)

    Returns AwsIotMqttConnectionConfigBuilder

with_endpoint

  • with_endpoint(endpoint: string): this
  • Configures the IoT endpoint for this connection

    Parameters

    • endpoint: string

      The IoT endpoint to connect to

    Returns this

with_keep_alive_seconds

  • with_keep_alive_seconds(keep_alive: number): this
  • Configures MQTT keep-alive via PING messages. Note that this is not TCP keepalive.

    Parameters

    • keep_alive: number

      How often in seconds to send an MQTT PING message to the service to keep the connection alive

    Returns this

with_port

  • with_port(port: number): this
  • The port to connect to on the IoT endpoint

    Parameters

    • port: number

      The port to connect to on the IoT endpoint. Usually 8883 for MQTT, or 443 for websockets

    Returns this

with_socket_options

  • Configures the common settings for the socket to use when opening a connection to the server

    Parameters

    Returns this

with_timeout_ms

  • with_timeout_ms(timeout_ms: number): this
  • Configures the TCP socket timeout (in milliseconds)

    Parameters

    • timeout_ms: number

      TCP socket timeout

    Returns this

with_will

  • Configures the will message to be sent when this client disconnects

    Parameters

    • will: MqttWill

      The will topic, qos, and message

    Returns this

Static new_mtls_builder

  • Create a new builder with mTLS cert pair in memory

    Parameters

    • cert: string

      Certificate, in PEM format

    • private_key: string

      Private key, in PEM format

    Returns AwsIotMqttConnectionConfigBuilder

Static new_mtls_builder_from_path

  • Create a new builder with mTLS file paths

    Parameters

    • cert_path: string

      Path to certificate, in PEM format

    • key_path: string

      Path to private key, in PEM format

    Returns AwsIotMqttConnectionConfigBuilder

Static new_websocket_builder

Static new_with_websockets

Generated using TypeDoc