Returns the configured MqttConnectionConfig. On the first invocation of this function, the TLS context is cached and re-used on all subsequent calls to build().
The configured MqttConnectionConfig
Overrides the default system trust store.
Buffer containing all trust CAs, in PEM format
Overrides the default system trust store.
Optional
ca_dirpath: stringOnly used on Unix-style systems where all trust anchors are stored in a directory (e.g. /etc/ssl/certs).
Optional
ca_filepath: stringSingle file containing all trust CAs, in PEM format
Determines whether or not the service should try to resume prior subscriptions, if it has any
true if the session should drop prior subscriptions when this client connects, false to resume the session
Configures the client_id to use to connect to the IoT Core service
The client id for this connection. Needs to be unique across all devices/clients.
Configures AWS credentials (usually from Cognito) for this connection
The service region to connect to
IAM Access ID
IAM Secret Key
Optional
aws_sts_token: stringSTS token from Cognito (optional)
Sets the custom authorizer settings. This function will modify the username, port, and TLS options.
The username to use with the custom authorizer. If an empty string is passed, it will check to see if a username has already been set (via WithUsername function). If no username is set then no username will be passed with the MQTT connection.
The name of the custom authorizer. If an empty string is passed, then 'x-amz-customauthorizer-name' will not be added with the MQTT connection. It is strongly recommended to URL-encode this value; the SDK will not do so for you.
The signature of the custom authorizer. If an empty string is passed, then 'x-amz-customauthorizer-signature' will not be added with the MQTT connection. The signature must be based on the private key associated with the custom authorizer. The signature must be base64 encoded. Required if the custom authorizer has signing enabled.
The password to use with the custom authorizer. If null is passed, then no password will be set.
Optional
token_key_name: stringKey used to extract the custom authorizer token from MQTT username query-string properties. Required if the custom authorizer has signing enabled. It is strongly suggested to URL-encode this value; the SDK will not do so for you.
Optional
token_value: stringAn opaque token value. Required if the custom authorizer has signing enabled. This value must be signed by the private key associated with the custom authorizer and the result placed in the token_signature argument.
Configures the IoT endpoint for this connection
The IoT endpoint to connect to
Configure the http proxy options to use to establish the connection
proxy options to use to establish the mqtt connection
Configures MQTT keep-alive via PING messages. Note that this is not TCP keepalive.
How often in seconds to send an MQTT PING message to the service to keep the connection alive
Sets password for the connection
the password that will be passed with the MQTT connection
Configures the PINGREQ response timeout (in milliseconds)
PINGREQ response timeout
The port to connect to on the IoT endpoint
The port to connect to on the IoT endpoint. Usually 8883 for MQTT, or 443 for websockets
Configures the protocol operation timeout (in milliseconds)
protocol operation timeout
Configure the max reconnection period (in second). The reonnection period will be set in range of [reconnect_min_sec,reconnect_max_sec].
max reconnection period
Configure the min reconnection period (in second). The reonnection period will be set in range of [reconnect_min_sec,reconnect_max_sec].
min reconnection period
Configures the common settings for the socket to use when opening a connection to the server
The socket settings
Configures the TCP socket timeout (in milliseconds)
TCP socket timeout
Sets username for the connection
the username that will be passed with the MQTT connection
Configures the will message to be sent when this client disconnects
The will topic, qos, and message
Static
new_For API compatibility with the browser version. Alias for new_with_websockets.
a new websocket connection builder object with default TLS configuration
Static
new_Creates a new builder with default Tls options. This requires setting the connection details manually.
Static
new_Create a new builder with mTLS cert pair in memory
Certificate, in PEM format
Private key, in PEM format
Static
new_Create a new builder with mTLS file paths
Path to certificate, in PEM format
Path to private key, in PEM format
Static
new_Create a new builder with mTLS using a PKCS#11 library for private key operations.
NOTE: This configuration only works on Unix devices.
PKCS#11 options.
Static
new_Create a new builder with mTLS using a PKCS#12 file for private key operations.
Note: This configuration only works on MacOS devices.
The PKCS#12 options to use in the builder.
Static
new_Create a new builder with mTLS using a certificate in a Windows certificate store.
NOTE: This configuration only works on Windows devices.
Path to certificate in a Windows certificate store.
The path must use backslashes and end with the certificate's thumbprint.
Example: CurrentUser\MY\A11F8A9B5DF5B98BA3508FBCA575D09570E0D2C6
Static
new_Rest
...args: any[]Static
new_Configures the connection to use MQTT over websockets. Forces the port to 443.
Optional
options: WebsocketConfigGenerated using TypeDoc
Builder functions to create a MqttConnectionConfig which can then be used to create a MqttClientConnection, configured for use with AWS IoT.