MQTT Ports Explained: TLS Setup and Testing with Mqttable
Choose MQTT ports for local devices, cloud gateways, and browser dashboards. Configure TLS and mTLS certificates, then verify real messages with Mqttable.

If your sensor publishes locally but cannot reach a cloud broker, check the connection details as a set: transport, hostname, port, TLS settings, and authentication. Changing the number from 1883 to 8883 does not enable encryption on either side.
Choose a connection for local debugging, devices connecting to the cloud, or a browser dashboard, then use Mqttable to connect and exchange messages. The TLS walkthrough starts with certificate generation and explains where each file belongs and which fields to fill in.
Scroll the table sideways to see all columns.
| Connection | Common port or example | What you need | Typical use |
|---|---|---|---|
| MQTT over TCP, mqtt | 1883 | A matching MQTT listener; account credentials if required | Loopback development; explicitly trusted private networks |
| MQTT over TLS, mqtts | 8883 | TLS listener, trusted server certificate, matching hostname; account credentials if required | Internet-connected gateways and cloud services |
| MQTT over WebSocket, ws | 8083 (EMQX default) | WebSocket listener and the correct URL path | Local browser/dashboard development |
| MQTT over secure WebSocket, wss | 8084 (EMQX default) | WebSocket listener, path, and TLS trust | HTTPS dashboards and WebSocket-compatible infrastructure |
| Native MQTT/TLS on 443 | 443, only when the service supports it | Service-specific TLS, authentication, and sometimes ALPN | Services that explicitly offer an MQTT/TLS 443 endpoint |
| MQTT over QUIC | For example, EMQX's 14567/UDP | A QUIC-capable broker and client | A deliberately selected QUIC deployment |
IANA registers 1883 for MQTT and 8883 for secure MQTT. EMQX defaults to 8083 for WS and 8084 for WSS, and Mqttable pre-fills these ports when you create a Broker.
8083/8084 are EMQX defaults. A provider can specify other ports or offer WSS on 443; use the connection address it supplies. The Mosquitto lab below explicitly configures WS/WSS on 9001/9002, so its screenshots use those lab ports.
The port does not identify an MQTT protocol version: MQTT 3.1.1 and 5.0 can use the same listener. Nor does an IANA UDP entry mean that an ordinary MQTT/TCP client can use UDP. MQTT 5.0 requires an ordered, lossless, bidirectional connection; QUIC requires explicit support on both ends.
First identify where the client runs: in a device or program, or directly in a web page's JavaScript. Then consider whether the connection crosses the Internet or a shared network. Use these three scenarios to choose.
When the program and broker run on the same computer, use mqtt://127.0.0.1:1883 to check connections, subscriptions, and payloads. Bind the broker to loopback; you do not need to configure TLS certificates for this first local check.
You can also use 1883 for temporary LAN testing, but plain MQTT does not encrypt usernames, passwords, or messages. If the connection uses a shared network or carries sensitive data, use the TLS setup below.
A home gateway reporting status, a factory data collector, or a remote device can start with the provider's mqtts endpoint. 8883 is common. If the provider specifies another port, use its connection information.
Prepare the broker hostname, port, and MQTT account, and keep server identity verification enabled. Publicly trusted certificates usually work with System CA; a private CA needs an additional CA certificate. TLS protects the transport, while accounts and topic permissions still follow the broker's policy.
A web page's JavaScript cannot open an ordinary MQTT/TCP connection directly, so it needs WebSocket. A browser dashboard displaying temperature readings, for example, uses ws or wss and a WebSocket Path.
With EMQX, local development can use WS/8083. An HTTPS dashboard uses WSS/8084, or the provider's WSS/443 endpoint. WSS also needs the correct TLS trust settings. When testing with Mqttable, select the protocol and port that the dashboard will use.
mTLS adds client-certificate authentication to TLS; it does not require a different transport protocol. Choose the mqtts or wss endpoint first, then configure the client certificate and matching private key required by the broker.
Ordinary TLS and mTLS can use the same port. The listener configuration determines whether a client certificate is required. This guide uses 8883 for ordinary TLS and 8884 for mTLS so you can compare them.
If you do not already have a test broker, complete the local lab below first, then return here. Its configuration enables both 1883 and 1884.
- In Connections → New Broker, enter a name such as
Port Lab, protocolmqtt, Host127.0.0.1, and Port1883. The Host field contains only the hostname or IP, not the entire URL. - Save the broker and add a client with a unique Client ID, MQTT 5.0, and Authentication Method None for this loopback-only lab.
- Connect the client. Subscribe to the exact topic
mqttable/ports/lab/1883at QoS 1, with No Local disabled. - Wait for a successful SUBACK before sending. Publish
{"sensor":"lab-sensor","temperature":23.5,"test":"1883"}to that same topic, QoS 1, Retain off. - In Trace, find the outgoing and incoming PUBLISH rows with the same topic and payload. A PUBACK by itself is not evidence that your subscriber received the message.

The endpoint uses mqtt, not TLS. The two PUBLISH directions verify this local message loop, not encrypted transport.
Change the broker's port to 1884, reconnect, and repeat with mqttable/ports/lab/1884. The listener is still configured as plain MQTT. The port field and successful connection test below demonstrate a custom port, not a security upgrade.

The selected transport remains mqtt. Client and listener must use the same port and transport.
127.0.0.1 means the machine running the Mqttable Runtime. If you use a remote Runtime, it does not mean the computer displaying the page. A Docker host mapping such as 1884:1883 similarly means that a host-side client connects to 1884 while the container listener uses 1883.
Before opening Mqttable, copy these items from the deployment's connection page:
- Broker hostname, not an HTTP dashboard URL.
- Native TLS or WSS port, plus the WebSocket Path for WSS.
- MQTT username and password, created in the service's authentication settings. A cloud-console login is not necessarily an MQTT account.
- A CA certificate or CA bundle if the provider tells you to use one.
- Client certificate and private key only if client-certificate authentication is required.
EMQX Cloud Serverless documents mqtts on 8883 and wss on 8084. Its guide also requires MQTT authentication and correct SNI. Use the hostname supplied for your own deployment; do not substitute the public broker's hostname.
In Mqttable, create the broker with mqtts, the supplied Host, and Port. Keep Verify Server Identity on. Start with Server Certificate Trust → System CA when the endpoint uses a chain already trusted by the Runtime. Leave mTLS off, SNI on Auto, and ALPN empty unless the provider specifies otherwise.
If a private CA is required, select Custom CA, then upload the provided CA certificate or select its saved reference. Do not upload server.key. A service may publish a CA download even when your Runtime already trusts its root; determine which trust path applies to your endpoint rather than assuming that every cloud connection needs an upload. An incomplete server chain is a server-side issue, not a reason to disable verification. Let's Encrypt explains the difference between root trust and a missing certificate chain.
Save the broker, add a Client, choose password authentication, and enter the MQTT username/password or a saved Password Secret. Connect and repeat the subscribe-before-publish check on a topic that the account is allowed to use.
Mqttable's Broker Test Connection does not send MQTT username/password. It uses the TLS configuration and probes MQTT versions. A password-protected service can reject the probe after a successful TLS handshake. Save the broker and test the credentials in the Client; do not treat every authentication rejection as a TLS failure.

The System CA connection test passes without uploading a certificate. This example connects to the public test broker broker.emqx.io; its messages are visible to other users, so do not send sensitive data.
The local lab needs OpenSSL 3 and Mosquitto. Installation instructions are given for macOS and Debian/Ubuntu; both use the same Bash commands for certificate generation and listener configuration.
On macOS with Homebrew:
brew install openssl@3 mosquitto
export PATH="$(brew --prefix openssl@3)/bin:$(brew --prefix)/sbin:$PATH"On Debian/Ubuntu:
sudo apt update
sudo apt install openssl mosquitto mosquitto-clientsCheck openssl version and mosquitto -h. OpenSSL must be version 3 for these examples. Your Mosquitto package must support WebSocket for the optional WS/WSS listeners; older packages may require libwebsockets support at build time. If the package manager started a broker service, check its listeners before launching another process. Do not stop someone else's broker to free a port.
Create a new directory outside any repository:
LAB_DIR=$(mktemp -d "${TMPDIR:-/tmp}/mqtt-ports-lab.XXXXXX") &&
cd "$LAB_DIR" &&
pwdmktemp creates a new private directory instead of overwriting an existing one. Keep the printed path: enter that same directory in the second terminal and the file chooser. On macOS, Command+Shift+G in the chooser lets you enter a folder path. Stop if any command fails; do not continue into the next block. The directory permissions and umask below restrict this lab's files. The certificates expire after seven days; regenerate them when repeating the lab later.
Scroll the table sideways to see all columns.
| File | Owner and purpose | What goes into Mqttable |
|---|---|---|
| ca.crt | Public certificate of the lab's signing CA | CA Certificate, to trust this CA |
| ca.key | Signing private key; keep with the lab's issuer | Nothing; never distribute it to clients |
| server.crt | Broker's identity certificate | Normally nothing; the broker sends it during TLS |
| server.key | Broker's matching private key | Nothing; keep it only on the broker side |
| client.crt | Identity of the lab's mTLS client | Client Certificate, when mTLS is required |
| client.key | Client's matching private key | Private Key, for that client only |
The ordinary TLS path needs a trusted CA, not the server's private key. mTLS additionally needs the client's own certificate and key. In production, obtain these materials from your broker administrator or PKI team; Mqttable stores and uses credentials but does not issue certificates.
umask 077
mkdir -p certs
openssl req -x509 -newkey rsa:2048 -noenc -sha256 -days 7 \
-subj "/CN=Mqttable Port Lab CA" \
-addext "basicConstraints=critical,CA:TRUE" \
-addext "keyUsage=critical,keyCertSign,cRLSign" \
-keyout certs/ca.key -out certs/ca.crtExpected files: certs/ca.crt and certs/ca.key. CA:TRUE and the signing key usage identify this as a CA. A seven-day certificate may appear as “expiring soon” in the UI while it is still valid. Do not install this experimental CA into your operating system's global trust store. Mqttable's Custom CA can trust it for the broker configuration without changing system-wide trust.
openssl req -new -newkey rsa:2048 -noenc -sha256 \
-subj "/CN=localhost" \
-keyout certs/server.key -out certs/server.csr
cat > certs/server.ext <<'EOF'
basicConstraints=critical,CA:FALSE
keyUsage=critical,digitalSignature,keyEncipherment
extendedKeyUsage=serverAuth
subjectAltName=DNS:localhost,IP:127.0.0.1
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid,issuer
EOF
openssl x509 -req -in certs/server.csr \
-CA certs/ca.crt -CAkey certs/ca.key -CAcreateserial \
-out certs/server.crt -days 7 -sha256 -extfile certs/server.extThe final certificate contains DNS:localhost and IP:127.0.0.1. Connect using one of those names. If you move the broker to another machine, issue a new certificate containing its actual DNS name or IP. Editing the Host field does not change the certificate.
The CSR is a request, not the final signed certificate. Passing server.ext to openssl x509 explicitly adds the SAN and serverAuth purpose to the signed result. A CN alone is not a substitute for this check. OpenSSL documents SAN and extended key usage.
openssl verify -CAfile certs/ca.crt -purpose sslserver certs/server.crt
openssl x509 -in certs/server.crt -noout -dates -ext subjectAltName
openssl x509 -in certs/server.crt -pubkey -noout | openssl pkey -pubin -outform DER | openssl dgst -sha256
openssl pkey -in certs/server.key -pubout -outform DER | openssl dgst -sha256Expect certs/server.crt: OK, the two SAN entries, and matching public-key SHA-256 hashes on the last two lines. Those hashes do not expose the private key. Check the validity dates against the current clock; do not copy a certificate from the screenshot for future use.
Run this from the same lab directory. The unquoted heredoc intentionally expands $PWD into absolute certificate paths:
cat > mosquitto.conf <<EOF
persistence false
allow_anonymous true
listener 1883 127.0.0.1
protocol mqtt
listener 1884 127.0.0.1
protocol mqtt
listener 8883 127.0.0.1
protocol mqtt
certfile $PWD/certs/server.crt
keyfile $PWD/certs/server.key
tls_version tlsv1.2
require_certificate false
listener 8884 127.0.0.1
protocol mqtt
cafile $PWD/certs/ca.crt
certfile $PWD/certs/server.crt
keyfile $PWD/certs/server.key
tls_version tlsv1.2
require_certificate true
listener 9001 127.0.0.1
protocol websockets
listener 9002 127.0.0.1
protocol websockets
certfile $PWD/certs/server.crt
keyfile $PWD/certs/server.key
tls_version tlsv1.2
require_certificate false
EOFThe lab enables plain MQTT on 1883/1884, TLS on 8883, mTLS on 8884, WS on 9001, and WSS on 9002. The 8884 listener is ready for the optional client certificate you will create below. All listeners bind only to 127.0.0.1.
allow_anonymous true removes MQTT password setup from this local certificate exercise. It does not disable 8884's certificate requirement and is not a production configuration. This lab has no Topic ACL.
For ordinary TLS, certfile and keyfile provide the broker's certificate and private key. On the mTLS listener, cafile tells the broker which CA may sign client certificates; require_certificate true requires a valid client certificate. This server-side CA role is distinct from Mqttable's CA trust setting. Mosquitto's configuration manual describes these options.
Start Mosquitto in this terminal:
mosquitto -c "$PWD/mosquitto.conf" -vExpect listener startup messages for the six ports. Keep the terminal open. If you see “Address already in use,” check which process owns the port; do not launch more duplicates. If you change the configuration, stop this lab process with Ctrl+C and start it again. Never use chmod 777 to solve certificate permission errors.
You can reuse two local broker definitions for these experiments: Port Lab for plain MQTT/WS, and TLS Lab for TLS/mTLS/WSS. Disconnect the client before changing transport, port, path, or TLS material, save, then reconnect. A cloud endpoint can use a separate definition; you do not need to keep a new broker definition for every lab port.
- Create a Broker named
TLS Labwith protocol mqtts, Host 127.0.0.1, Port 8883. - Keep Verify Server Identity enabled. Select Custom CA.
- In CA Certificate, use Upload to choose
certs/ca.crt. You can also add it in Credentials, give it the labelPorts Lab CA, and choose the saved reference in the broker form. - Keep Client Authentication (mTLS) off, SNI on Auto, and ALPN empty.
- Run Test Connection. The local anonymous listener should accept the MQTT probes. Save the broker, add a Client, and connect.

The CA validates the broker's certificate. The separate connection-test result establishes TLS and MQTT CONNECT, not subscriber delivery.
For an independent TLS-only check, open a second terminal in the lab directory:
printf '' | openssl s_client -connect 127.0.0.1:8883 -servername localhost \
-verify_ip 127.0.0.1 -CAfile certs/ca.crt -verify_return_errorLook for Verification: OK or Verify return code: 0 (ok). This does not send an MQTT CONNECT or test topic permissions. Use Mqttable to subscribe, receive SUBACK, publish, and compare the two PUBLISH directions.
On ordinary TLS, the client verifies the broker. On mTLS, the broker also verifies the client certificate. Your CA trust and your client identity remain separate inputs.
In a second terminal, enter the same lab directory and run:
openssl req -new -newkey rsa:2048 -noenc -sha256 \
-subj "/CN=mqttable-lab-client" \
-keyout certs/client.key -out certs/client.csr
cat > certs/client.ext <<'EOF'
basicConstraints=critical,CA:FALSE
keyUsage=critical,digitalSignature
extendedKeyUsage=clientAuth
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid,issuer
EOF
openssl x509 -req -in certs/client.csr \
-CA certs/ca.crt -CAkey certs/ca.key -CAcreateserial \
-out certs/client.crt -days 7 -sha256 -extfile certs/client.ext
chmod 600 certs/*.keyopenssl verify -CAfile certs/ca.crt -purpose sslclient certs/client.crt
openssl x509 -in certs/client.crt -pubkey -noout | openssl pkey -pubin -outform DER | openssl dgst -sha256
openssl pkey -in certs/client.key -pubout -outform DER | openssl dgst -sha256Expect certs/client.crt: OK and matching hashes. The clientAuth usage is deliberate; do not reuse the broker's server.key as your client key.
These are unencrypted lab private-key files protected by permissions. Mqttable currently rejects password-encrypted PEM private keys. If your organization supplied an encrypted key, ask its administrator for an approved client-compatible handling procedure. Do not expose the key in a terminal transcript, article, screenshot, or MCP argument.
- Use
mqtts, Host127.0.0.1, Port 8884. In this lab, that port selects the listener withrequire_certificate true. - Keep server verification on and Custom CA →
ca.crtselected. - Enable Client Authentication (mTLS).
- Upload Client Certificate →
client.crtand Private Key →client.key, or choose their saved references. - Save the broker, connect a Client, and perform the same subscribe-before-publish test with
mqttable/ports/lab/mtls.

The CA verifies the server; the client certificate and its matching key identify the client. The private-key contents are not displayed.
Mqttable binds these TLS materials to the Broker definition, so its Clients reuse that identity. To compare different device certificates, use separately configured Broker definitions; changing only an MQTT Client ID does not change the certificate.
The Client table's No auth label refers to MQTT account authentication. This lab still authenticates the client at the TLS listener using its certificate. Whether a production broker also requires an MQTT account and which topics it authorizes depends on its policy.

Subscribe and receive a successful SUBACK before publishing. Trace shows outgoing and incoming PUBLISH rows with the same topic and payload.
As a negative check, remove the client certificate/key configuration from a test connection while keeping the correct CA and server verification on. The lab's 8884 listener must refuse it. A successful server-certificate verification followed by “certificate required” is still a failed mTLS connection. In our Mqttable probe, the refusal surfaced as Failed to send CONNECT: :closed; Mosquitto logged the missing client certificate, and OpenSSL reported tlsv13 alert certificate required. A generic closed connection alone is not enough to identify that cause.
The seven-day CA above is for a loopback exercise. For a public deployment, obtain a server certificate for the real broker hostname from a public CA or your approved PKI. Configure the broker's certfile with the server certificate followed by the required intermediate certificates, and keyfile with the matching server private key. Do not distribute that key to clients. EMQX also documents the server-chain order.
With a publicly trusted chain, the client may use System CA. With a private CA, distribute the intended trust certificate/bundle through a trusted channel, then use Custom CA. For mTLS, separately distribute each client's own certificate and key; configure the broker to trust their issuer. TLS authentication does not automatically grant topic access.
The commands and Mosquitto configuration in this article use PEM. A .crt or .pem filename alone does not tell you whether it is a CA, leaf certificate, or chain. Inspect a certificate without exposing its private key:
openssl x509 -in certs/server.crt -noout -subject -issuer -dates -ext subjectAltNameIf an administrator supplies a .p12/.pfx package or an encrypted key, obtain the supported materials through an approved process instead of uploading the whole package into an unrelated field. Ensure the broker service account can read its certificate/key files without making the keys world-readable. Plan expiry monitoring and renewal; do not copy this anonymous lab configuration to a public server.
For this lab, configure Mqttable with ws, Host 127.0.0.1, Port 9001, and WebSocket Path /mqtt. Connect and repeat the message check. Then use wss on 9002, keep server verification enabled, choose the same Custom CA, and repeat.

WS uses a WebSocket handshake but does not encrypt this listener. /mqtt is the path tested here, not a path guaranteed for every broker.

WSS combines the WebSocket path with TLS. The connection-test result passed for this configuration. The chosen port 9002 is a lab setting, not a standard WSS port.
On a provider's endpoint, use its exact port and path. A reverse proxy must forward WebSocket upgrades to a WebSocket listener; pointing it at a raw MQTT/TCP listener is not equivalent. An HTTPS page should not directly open an unencrypted ws connection.
Port 443 is useful when the service offers WSS through HTTPS infrastructure, but an open 443 firewall rule does not guarantee that the service or corporate proxy accepts WebSocket. Check the allowed protocol and your organization's policy rather than using 443 to bypass controls.
AWS IoT provides a second example: native MQTT on 443 with X.509 authentication uses ALPN x-amzn-mqtt-ca. That is MQTT/TLS, not WSS. Other AWS authentication modes have different requirements. Do not switch Mqttable to wss just because the port is 443; follow the endpoint's exact protocol and authentication instructions.
Scroll the table sideways to see all columns.
| Observation | Check next | What not to change blindly |
|---|---|---|
| DNS error, timeout, connection refused | Host, DNS, listener process, destination port, firewall, Docker/NAT mapping, Runtime location | Certificates cannot fix a listener that is not reachable |
| Connection closes immediately with a protocol error | mqtt vs mqtts, or raw MQTT vs WS/WSS | A port number alone does not enable TLS or WebSocket |
| Unknown CA or chain verification failure | The correct CA/bundle; intermediate certificates sent by the server | Do not turn verification off |
| Hostname mismatch | Actual Host against the certificate's DNS/IP SAN | Do not assume an IP is covered by a DNS SAN |
| Expired/not-yet-valid certificate | Certificate dates and the Runtime/broker clocks | Do not solve expiry by disabling date checks |
| Client certificate required or rejected | mTLS enabled; client certificate/key pair; issuer trusted by the broker | A CA file alone is not a client identity |
| MQTT CONNACK rejects authentication | Client username/password, enabled account, required authentication mode | Do not blame TLS if it has already completed |
| Connected but no messages | SUBACK result, exact topic, ACL, QoS, No Local, and subscription timing | CONNECT success does not grant every topic permission |
| HTTP 404/upgrade failure on WS/WSS | Path and WebSocket-capable proxy/listener | /mqtt is not a universal path |

An intentionally unrelated CA fails against the local TLS listener. Fix the trust material; keep verification enabled.
For a useful support report, include the selected transport, sanitized Host/Port/Path, the failing stage, exact error text, versions, and certificate validity/SAN metadata. Never include passwords, ca.key, server.key, or client.key. Do not subscribe to # on a public broker to see whether “anything comes through.” Use your own unique test topic.
You can configure a broker listener on another available port and set the client to match. Both ends still need the same transport. Moving plain MQTT from 1883 to 1884 does not add encryption.
No. A publicly trusted server often works with System CA and no uploads. A private CA usually adds a CA certificate. Client certificate and private key are needed only when the broker requires mTLS.
They can authenticate an MQTT client but do not encrypt a plain TCP connection. For untrusted networks, use TLS and appropriate authorization instead of relying on the account alone.
Only when the server certificate covers that IP and the service supports that connection method. A certificate for broker.example.com does not automatically cover the IP to which that hostname resolves. Cloud services may also require SNI; prefer their supplied hostname.
No. It proves the tested connection stages, not topic authorization or subscriber delivery. Subscribe first, confirm SUBACK, publish on the authorized topic, then check the received PUBLISH.
No. It is an EMQX public-broker QUIC listener example. Choose QUIC only when both client and broker support it and the network permits the required UDP traffic.
For the next test, take the endpoint information from your own broker, keep server verification enabled, and verify one permitted topic end to end. The Mqttable connection guide, TLS guide, credential guide, and publish/subscribe guide cover the corresponding controls. New to MQTT? Start with the getting-started walkthrough.