Developer quickstart

Your first message in three steps

ConnectMQ speaks standard MQTT, so the client library you already know works unchanged. Grab your credentials, pick a sample and connect.

  1. Sign up

    Create your account at app.connectmq.com and open your broker.

  2. Create credentials

    Add a username and password for your device or service and allow the topics it needs.

  3. Connect

    Use one of the samples below — replace YOUR_USERNAME and YOUR_PASSWORD and run it.

Endpoints

Ports and protocols

Use TLS (8883) for devices and services, secure WebSockets (8084) for browsers.

MQTT1883mqtt://broker.connectmq.com:1883TCP
MQTT over TLS8883mqtts://broker.connectmq.com:8883TCP + TLS
WebSocket8083ws://broker.connectmq.com:8083/mqttBrowsers (HTTP pages)
Secure WebSocket8084wss://broker.connectmq.com:8084/mqttBrowsers (HTTPS pages)
Code samples

Copy, paste, connect

Each sample connects over TLS (or secure WebSockets in the browser), subscribes to devices/+/telemetry and publishes a JSON reading.

All code samples

client.py · pip install "paho-mqtt>=2.0"
import paho.mqtt.client as mqtt

def on_connect(client, userdata, flags, reason_code, properties):
    print("Connected:", reason_code)
    client.subscribe("devices/+/telemetry", qos=1)
    client.publish("devices/sensor-1/telemetry", '{"temperature": 21.5}', qos=1)

def on_message(client, userdata, msg):
    print(msg.topic, msg.payload.decode())

client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, client_id="sensor-1")
client.username_pw_set("YOUR_USERNAME", "YOUR_PASSWORD")
client.tls_set()  # TLS on port 8883
client.on_connect = on_connect
client.on_message = on_message

client.connect("broker.connectmq.com", 8883)
client.loop_forever()

Developer FAQ

Which port should I use?

Use 8883 (MQTT over TLS) for devices and services, and 8084 (secure WebSockets, path /mqtt) for browser apps. 1883 and 8083 are unencrypted and meant for quick tests only.

Where do I find my username and password?

In your ConnectMQ dashboard at app.connectmq.com after you sign up. Create separate credentials for each device or service.

My client cannot connect — what should I check?

Check the port matches the protocol (TLS on 8883, WSS on 8084 with path /mqtt), that the credentials are correct, and that each client uses a unique client ID.

Ready to connect your first device?

Create an account, get your broker credentials and connect your first device — no servers to install, patch or scale.