Skip to content

Getting Started with MQTT

Prerequisites

  • Basic understanding of MQTT protocol
  • MQTTX CLI installed

Step 1: Sign up

If you haven't signed up yet, you can sign up for free here: https://flowmq.io/auth/sign-up

Sign up with your email, GitHub, or Google account.

Step 2: Create a Project

Once logged in, you'll need to create your first project for free:

  1. Click Create your first project on the dashboard
  2. Enter a project name (e.g., "my-mqtt-app")
  3. Choose your preferred cloud platform and region
  4. Click Create

Your project will be provisioned within a few seconds. Once ready, you'll see your project dashboard with connection details.

Step 3: Set up Authentication Credentials

NOTE

FlowMQ Platform uses TLS and secure authentication for all connections.

To set up your credentials:

  1. In your project dashboard, navigate to Authentication
  2. Click Add Credential
  3. Enter Username and Password
  4. Click Create Credential

IMPORTANT

Save your password. The password will not be shown again for security reasons.

Step 4: Publish MQTT Messages

Let's use MQTTX CLI to publish messages to your FlowMQ project. See here to learn how to install MQTTX CLI on your system.

First, you need to get your project's connection details. In your project dashboard, navigate to Overview, you can get connection details there.

Publish messages with MQTTX CLI like below(replace the connection details with your FlowMQ project information):

IMPORTANT

Must use TLS and secure authentication to connect to your FlowMQ project.

bash
mqttx pub \
  -h your-project-id.flowmq.cloud \
  -p 8883 \
  -l mqtts \
  -t t/1 \
  --username your-username \
  --password your-password \
  --message 'Hello, FlowMQ!'

Step 5: Subscribe to MQTT Messages

Start another terminal window, subscribe to MQTT messages like below(replace the connection details with your FlowMQ project information):

IMPORTANT

Must use TLS and secure authentication to connect to your FlowMQ project.

bash
mqttx sub \
  -h your-project-id.flowmq.cloud \
  -p 8883 \
  -l mqtts \
  -t t/1 \
  --username your-username \
  --password your-password

After subscribing successfully, publish more messages, you should see the subscriber receives all published messages.

Step 6: Persist MQTT Messages to a Stream

FlowMQ's unified architecture makes persisting your MQTT messages to a stream and consuming them by Kafka clients seamless than ever.

Let's create a stream:

  1. In your project dashboard, go to Streams
  2. Click Create Stream
  3. Enter Stream Name: my-stream
  4. Enter Topic Filters: t/#
  5. Click Create Stream

Now all MQTT messages published to topics matched by t/# will be automatically persisted to the stream my-stream. You can view the stream details in your dashboard.

Step 7: Consume Messages from Stream Using Kafka Client

After persisting MQTT messages to a stream, you can consume the messages using a Kafka client. This is perfect for batch processing, analytics, or data pipeline integration.

See Getting Started with Kafka to continue.

Next Steps

🎉 Congratulations! You've successfully:

  • ✅ Created a FlowMQ project
  • ✅ Set up secure authentication credentials
  • ✅ Published and subscribed to MQTT messages using MQTTX CLI
  • ✅ Persisted messages to a stream

What's Next?

Happy messaging with FlowMQ!