# Connection (/docs/settings/mqtt/connection)



The settings below are modelled after HiveMQ client library's documentation for
[client configurations](https://hivemq.github.io/hivemq-mqtt-client/docs/client-configuration)
and
[mqtt operations -> connect](https://hivemq.github.io/hivemq-mqtt-client/docs/mqtt-operations/connect/#connect).

### 1. Server Host [#1-server-host]

The hostname or IP address of the MQTT broker the app should connect to.

For example,

* 192.168.1.190
* broker.hivemq.com
* broker.emqx.io

**Default:** 127.0.0.1

### 2. Server Port [#2-server-port]

The [port](https://www.emqx.com/en/blog/mqtt-ports#default-mqtt-ports-numbers)
of the MQTT broker the app should connect to.

Typically,

* `1883`: MQTT (TCP)
* `8883`: MQTTS (TCP with SSL/TLS)
* `80`: WS (WebSocket, same port as HTTP)
* `443`: WSS (WebSocket Secure, same port as HTTPS)

When using WebSocket (e.g. on port 80 or 443), you will also need to enable
the setting [Use WebSocket](#13-use-websocket)

**Default:** 1883

### 3. Use TLS [#3-use-tls]

When enabled, the client will connect securely to the broker
using TLS. Ensure the broker supports TLS on the configured port.

**Default:** false

### 4. Username [#4-username]

The username used to authenticate with the MQTT broker.

**Default:** (blank)

### 5. Password [#5-password]

The password used to authenticate with the MQTT broker.

**Default:** (blank)

### 6. Client ID [#6-client-id]

A unique identifier for this client when connecting to the MQTT broker.

Leave this field blank if you want the broker server to generate a
client ID for Webview Kiosk.

Global variables are supported.

**Default:** (blank)

### 7. Clean Start [#7-clean-start]

When enabled, the MQTT client will start a new session on connect,
discarding any previous session state stored by the broker.

When disabled, the client will resume the previous session
(subscriptions, in-flight messages, etc.) if it exists.

**Default:** true

### 8. Keep Alive [#8-keep-alive]

The time interval (in seconds) in which the client sends a ping to the broker
if no other MQTT packets are sent during this period of time.

It is used to determine if the connection is still up.

**Default:** 60

### 9. Connect Timeout (seconds) [#9-connect-timeout-seconds]

The timeout between sending the Connect and receiving the ConnAck message.

Use 0 to disable the timeout.

**Default:** 30

### 10. Socket Connect Timeout (seconds) [#10-socket-connect-timeout-seconds]

The timeout for connecting the socket to the server.

Use 0 to disable the timeout.

**Default:** 5

### 11. Automatic Reconnect [#11-automatic-reconnect]

When enabled, attempt to automatically reconnect to the MQTT broker
after an unexpected disconnect.

In Webview Kiosk, this is implemented linearly at a fixed 3-second interval.

**Default:** true

### 12. Session Expiry Interval (seconds) [#12-session-expiry-interval-seconds]

Specify the maximum time a session is retained on the server after
disconnecting from the network.

The server will discard the corresponding session state when the
expiration time is reached.

**Default:** 0 (immediate expiry)

### 13. Use WebSocket [#13-use-websocket]

When enabled, the client will connect securely to the broker using TLS.
Ensure the broker supports TLS on the configured port, e.g.

* `80`: WS (WebSocket, same port as HTTP)
* `443`: WSS (WebSocket Secure, same port as HTTPS)

Use WebSocket only when necessary, as it consumes more resources than a direct
MQTT connection via TCP. For example, it may be required on networks where a
firewall blocks non-standard ports such as `8883` but allows HTTPS traffic.

**Default:** false

### 14. WebSocket Server Path [#14-websocket-server-path]

The path the MQTT broker WebSocket server listens on.

Must start with a `/`.

**Default:** /mqtt
