This guide shows you how to expose your MQTT server to the internet using ngrok. It covers setting up a local MQTT server, creating an ngrok TCP tunnel, and connecting to it using MQTT Explorer.Documentation Index
Fetch the complete documentation index at: https://ngrok.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
What you’ll need
- An ngrok account.
- The ngrok agent installed.
- MQTT Explorer installed.
- The Mosquitto binary installed.
1. Start an MQTT server
For this tutorial, use the Eclipse Mosquitto quickstart. Start the server by running this command in your terminal:1883.
You’ll see output like this:
2. Launch ngrok
Once your MQTT server is running successfully onlocalhost, you can put it online securely using ngrok.
Go to the ngrok dashboard and copy your authtoken.
Start ngrok by running the following command:
3. Connect with MQTT Explorer
Open MQTT Explorer and click the plus sign to create a new MQTT connection. Enter the TCP address from the last step and click Connect. You’ll see a few new lines in your MQTT server logs:example/topic.
You’ll see the message in the terminal tab where you subscribed to the topic: