Interface MqttConnectionConfig

Configuration options for an MQTT connection

Hierarchy

  • MqttConnectionConfig

Properties

clean_session?: boolean

Whether or not to start a clean session with each reconnect. If True, the server will forget all subscriptions with each reconnect. Set False to request that the server resume an existing session or start a new session that may be resumed after a connection loss. The session_present bool in the connection callback informs whether an existing session was successfully resumed. If an existing session is resumed, the server remembers previous subscriptions and sends messages (with QoS1 or higher) that were published while the client was offline.

client_id: string

ID to place in CONNECT packet. Must be unique across all devices/clients. If an ID is already in use, the other client will be disconnected.

credentials?: AWSCredentials

AWS credentials, which will be used to sign the websocket request

credentials_provider?: CredentialsProvider

Options for the underlying credentials provider

host_name: string

Server name to connect to

keep_alive?: number

The keep alive value, in seconds, to send in CONNECT packet. A PING will automatically be sent at this interval. The server will assume the connection is lost if no PING is received after 1.5X this value. This duration must be longer than ping_timeout.

password?: string

Password to connect with

ping_timeout?: number

Milliseconds to wait for ping response before client assumes the connection is invalid and attempts to reconnect. This duration must be shorter than keep_alive_secs. Alternatively, TCP keep-alive via :attr:SocketOptions.keep_alive may accomplish this in a more efficient (low-power) scenario, but keep-alive options may not work the same way on every platform and OS version.

port: number

Server port to connect to

protocol_operation_timeout?: number

Milliseconds to wait for the response to the operation requires response by protocol. Set to zero to disable timeout. Otherwise, the operation will fail if no response is received within this amount of time after the packet is written to the socket. It applied to PUBLISH (QoS>0) and UNSUBSCRIBE now.

reconnect_max_sec?: number

Maximum seconds to wait between reconnect attempts. Must be >= reconnect_min_sec. Wait starts at min and doubles with each attempt until max is reached.

reconnect_min_sec?: number

Minimum seconds to wait between reconnect attempts. Must be <= reconnect_max_sec. Wait starts at min and doubles with each attempt until max is reached.

socket_options: SocketOptions

Socket options, ignored in browser

username?: string

Username to connect with

websocket?: WebsocketOptions

Options for the underlying websocket connection

will?: MqttWill

Will to send with CONNECT packet. The will is published by the server when its connection to the client is unexpectedly lost.

Generated using TypeDoc