CloudSignal Docs
GuidesOnboarding

Your first MQTT connection

Connect to CloudSignal and send your first message using MQTTX or the command line.

This guide walks you through connecting to CloudSignal and sending your first message.

Prerequisites

Before starting, you need:

  1. A CloudSignal account. Sign up if you haven't already.
  2. An MQTT user. See Create MQTT user.
  3. Your organization ID. Found in Settings → Organization.

Connection details

ParameterValue
MQTT over TLSmqtts://mqtt.cloudsignal.app:8883
MQTT over WSSwss://connect.cloudsignal.app:18885/
Usernameyour_username@your_organization_id
PasswordThe password you set when creating the user

The username must include @organization_id. Just username alone won't work.

MQTTX is a free, cross-platform MQTT client with a graphical interface.

Download and install MQTTX

Download from mqttx.app for Windows, macOS, or Linux.

Create a new connection

  1. Click the + button to create a new connection.
  2. Fill in the connection details:
FieldValue
NameCloudSignal
URLmqtts://mqtt.cloudsignal.app:8883
SSL/TLSEnabled
Usernamemyuser@abc123-org-id
Passwordyour-password
  1. Click Connect.

Subscribe to a topic

  1. In the subscription panel, enter chat/lobby/#.
  2. Click Subscribe.

You're now listening for messages on all topics under chat/lobby/.

Publish a message

  1. In the message panel:
    • Topic: chat/lobby/messages
    • Payload: Hello, CloudSignal!
  2. Click Publish.

You should see your message appear in the received messages panel.

Option 2: Using the Mosquitto CLI

If you prefer the command line:

Install Mosquitto clients

On macOS:

brew install mosquitto

On Ubuntu or Debian:

sudo apt-get install mosquitto-clients

On Windows, download from mosquitto.org.

Subscribe to a topic

Open a terminal and run:

mosquitto_sub -h mqtt.cloudsignal.app -p 8883 \
  -u "myuser@abc123-org-id" \
  -P "your-password" \
  -t "chat/lobby/#" \
  --capath /etc/ssl/certs

This terminal displays incoming messages.

Publish a message

Open a second terminal and run:

mosquitto_pub -h mqtt.cloudsignal.app -p 8883 \
  -u "myuser@abc123-org-id" \
  -P "your-password" \
  -t "chat/lobby/messages" \
  -m "Hello from CLI!" \
  --capath /etc/ssl/certs

You should see the message appear in your subscriber terminal.

Option 3: Using code

JavaScript / Node.js

const mqtt = require('mqtt');

const client = mqtt.connect('mqtts://mqtt.cloudsignal.app:8883', {
  username: 'myuser@abc123-org-id',
  password: 'your-password',
});

client.on('connect', () => {
  console.log('Connected!');

  // Subscribe
  client.subscribe('chat/lobby/#');

  // Publish
  client.publish('chat/lobby/messages', 'Hello from Node.js!');
});

client.on('message', (topic, message) => {
  console.log(`${topic}: ${message.toString()}`);
});

Python

import paho.mqtt.client as mqtt
import ssl

def on_connect(client, userdata, flags, rc):
    print("Connected!")
    client.subscribe("chat/lobby/#")
    client.publish("chat/lobby/messages", "Hello from Python!")

def on_message(client, userdata, msg):
    print(f"{msg.topic}: {msg.payload.decode()}")

client = mqtt.Client()
client.username_pw_set("myuser@abc123-org-id", "your-password")
client.tls_set(cert_reqs=ssl.CERT_REQUIRED)
client.on_connect = on_connect
client.on_message = on_message

client.connect("mqtt.cloudsignal.app", 8883)
client.loop_forever()

Verify in dashboard

After connecting, you can verify in the CloudSignal dashboard:

  1. Go to SessionsActive Sessions.
  2. You should see your connected client.
  3. Check the client ID, username, and IP address.

Troubleshooting

"Connection refused"

  • Verify you're connecting to mqtts://mqtt.cloudsignal.app:8883 (native clients) or wss://connect.cloudsignal.app:18885/ (browser clients).
  • Check that TLS is enabled if using port 8883.

"Not authorized" or "Bad username or password"

  • Verify the username includes @organization_id.
  • Double-check the password.
  • Ensure the MQTT user exists and is active.

"Connection timeout"

  • Check your internet connection.
  • Verify the hostname is correct.
  • Try a different port.

Can't see messages

  • Make sure you subscribed before publishing.
  • Check that the topic patterns match.
  • Verify ACL rules allow access to the topic.

Next steps

Now that you're connected:

On this page