# MQTT Connection Properties

## `host` (string, required)

The host name of the broker

Example: `"test.mosquitto.org"`

## `port` (integer)

The port of the broker

Default: `1883`

Example: `1883`

## `scheme` (string, enum)

The protocol scheme

This element must be one of the following enum values:

* `mqtt`
* `mqtts`
* `tcp`
* `tls`
* `ws`
* `wss`

Default: `"mqtt"`

Example: `"mqtt"`

## `url` (string)

Complete connection string (takes precedence over host, port and scheme)

Examples: `"mqtt://some.host.org:1883"`, `"mqtts://some.host.org:8883"`

## `keepalive` (integer)

Time to keep the connection alive without any message send (in seconds)

Default: `0`

Example: `60`

## `reschedulePings` (boolean)

Whether to reschedule pings after sending packets

Default: `true`

## `clientId` (string)

The client id used when connecting to the broker

Example: `"mqttjs_13462"`

## `protocolVersion` (integer)

The protocol version used for the connection to the broker

Example: `4`

## `clean` (boolean)

Set to false to receive QoS 1 and 2 messages while offline

Default: `true`

## `reconnectPeriod` (integer)

Interval between two reconnections (milliseconds)

Default: `1000`

## `connectTimeout` (integer)

Time (in ms) to wait before a CONNACK is received

Default: `30000`

## `username` (string)

The username required by your broker, if any

Example: `""`

## `password` (string)

The password required by your broker, if any

Example: `""`

## `queueQoSZero` (boolean)

If connection is broken, queue outgoing QoS zero messages

Default: `true`

## `trustAllCertificates` (boolean)

If true, all broker certificates will be accepted, regardless of whether they can be validated or not. Use this option if self-signed server certificates should be accepted, or if there are other reasons which prevent this client to validate the certificates.

Default: `false`

## `mutualAuthentication` (boolean)

If true, a full certificate chain including client certificate is expected to connect properly with validated certificates.

Default: `false`

## `caCert` (string)

The root CA certificate as Base64 encoded PEM file content

## `clientCert` (string)

The device certificate as Base64 encoded PEM CRT file content

## `clientPrivateKey` (string)

The device private key as Base64 encoded PEM CRT file content

## `will` (object)

Properties of the `will` object:

#### `topic` (string, required)

Last will topic (LWT)

Example: `"last/will/topic"`

#### `payload` (string, required)

Last will message payload

Example: `""`

#### `qos` (integer, enum)

Last will message quality of service

This element must be one of the following enum values:

* `0`
* `1`
* `2`

Default: `0`

Example: `1`

#### `retain` (boolean)

Retain last message (Last-Value-Cached)

Default: `false`

#### `contentType` (string)

String describing the content of the Application Message (mqtt5 only)

#### `correlationData` (string)

The Correlation Data is used by the sender of the Request Message to identify which request the Response Message is for when it is received (mqtt5 only)

#### `messageExpiryInterval` (number)

Lifetime in seconds of the Will Message (mqtt5 only)

#### `payloadFormatIndicator` (boolean)

Will Message is UTF-8 Encoded Character Data or not (mqtt5 only)

#### `responseTopic` (string)

String which is used as the Topic Name for a response message in a request/response context (mqtt5 only)

#### `userProperties` (object)

Application specific key value pairs (mqtt5 only)

#### `willDelayInterval` (number)

Delay in seconds until the server publishes the Client's Will Message (mqtt5 only)

## `authenticationMethod` (string)

Identifier of the Authentication Method (mqtt5 only)

## `authenticationData` (string)

Binary data containing authentication data (mqtt5 only)

## `maximumPacketSize` (number)

Maximum Packet Size in bytes the Client is willing to accept (mqtt5 only)

## `receiveMaximum` (number)

The Client uses this value to limit the number of QoS 1 and QoS 2 publications that it is willing to process concurrently (mqtt5 only)

## `requestResponseInformation` (boolean)

The Client uses this value to request the Server to return Response Information in the CONNACK (mqtt5 only)

## `requestProblemInformation` (boolean)

The Client uses this value to indicate whether the Reason String or User Properties are sent in the case of failures (mqtt5 only)

## `sessionExpiryInterval` (number)

Session Expiry Interval in seconds (mqtt5 only)

## `topicAliasMaximum` (number)

The Client uses this value to limit the number of Topic Aliases that it is willing to hold on this Connection (mqtt5 only)

## `userProperties` (object)

Application specific key value pairs (mqtt5 only)

## `messageBufferWindowMs` (integer)

Duration in milliseconds for buffering incoming messages after connection establishment. When `clean` is set to `false`, this prevents message loss while re-establishing QoS 1 or QoS 2 endpoints and subscriptions. Messages arriving during this period are buffered and delivered once the endpoints and subscriptions have been registered.

Default: `10000`

Examples: `10000`, `30000`

Additional restrictions:

* Minimum: `2000`
* Maximum: `120000`

## `maxBufferedMessages` (integer)

Maximum number of messages that can be buffered during the connection establishment window. Once this limit has been reached, the buffering process stops and any incoming messages are delivered immediately to the endpoint. This prevents out-of-memory issues in high-throughput scenarios.

Default: `10000`

Examples: `100000`, `500000`

Additional restrictions:

* Minimum: `100`
* Maximum: `300000`
