Weekly EP16 - Connecting to a Serverless MQTT Broker using Postman
In this blog, we will explore the latest MQTT features of Postman by connecting to the EMQX Cloud Serverless.
Connecting to a Serverless MQTT Broker using Postman
Recently, the MQTT support in Postman has gained significant attention from developers. This is important news for Postman's support of eventing transport layers, and it can also simplify the development process for IoT developers. In this blog post, we will demonstrate how to establish a connection with EMQX Cloud Serverless using Postman.
Sign Up for Postman
Postman is a popular and versatile API development and testing tool that simplifies the process of working with APIs. With its intuitive interface and extensive feature set, Postman has become a go-to tool for developers across various domains. Now it expanded into the IoT field. If you haven't used Postman before, you can quickly register for a free account here.
Free Serverless MQTT Broker
EMQX Cloud Serverless is the latest MQTT broker offering on the public cloud with all the serverless advantages. You can start the Serverless deployment in seconds with just a few clicks. Additionally, users can get 1 million free session minutes every month, sufficient for 23 devices to be online for a whole month, making it perfect for tiny IoT test scenarios.
If you have not tried serverless deployment yet, please follow the guide in this blog to create one for free. Once you have completed the registration process with the online guide, you will get a running instance with the following similar information from the “Overview” in your deployment. We will use the connection information later.
Next, you need to configure the Authorization information in advance. The following image demonstrates how to configure these credentials under 'Authentication & ACL - Authentication' on the server side.
Creating a new MQTT request
To create a new MQTT request, click on the New button in the sidebar. This will open the Create new dialog. From the list, select MQTT to open a blank MQTT request in a new tab.
Connecting to EMQX Cloud Serverless
Next, you will see an MQTT Request page. Here, you can enter the information of the EMQ Cloud Serverless to establish a connection.
The URL format is:
wss://[connection address]:[port]/mqtt
For example, here the address is:
wss://*****.emqxsl.com:8084/mqtt
The * represents the connection address in EMQX Cloud Serverless.
In addition to the address information, you also need to configure Authorization information before creating a Serverless MQTT connection.
Click on "Connection", and you will see a message in the response area indicating that you're connected to the broker.
Subscribing to topics
While connected to the broker, select the Topics tab. I will test the connection by transmitting the temperature and humidity data of the room.
In the Topics column, enter
"home/device"
as the topic name.Select Subscribe to subscribe to the topic.
You will see a message in the response area indicating that you're subscribed to the topic.
Publishing messages
You can use the Message tab to publish messages to the topic.
Select the Message tab and enter
{ "Temperature": 17, "Humidity": 46 }
as the message.
Enter
"home/device”
as the topic name andJSON
as the message format.Click on Send to publish the message.
You will see an outgoing message in the response area indicating that the message was published. Since you have already subscribed to the topic, "home/device"
, you will also see an incoming message with the same body. Go ahead and send a few more messages containing the temperature and humidity of the room.
Using response visualizer
Now that you've subscribed to a topic and published a few messages, you can use the response visualizer to view the messages in a more comprehensible format.
Switch to the Visualization tab in the response area. You'll see the messages for the
Temperature
field visualized as a line chart.Select
"
+"
to add theHumidity
field to the chart and view the changes in the values.
The visualization changes in real time as you receive newer messages for the same topic.
Summary
In this blog, we explored the latest MQTT features of Postman by connecting to the EMQX Cloud Serverless. It is evident that Postman already supports basic MQTT functionalities, such as establishing a connection, subscribing to topics, publishing messages, and receiving real-time messages. Additionally, it also allows for simple real-time response visualization.
Would you use Postman for developing MQTT or IoT applications? Join our Discord for discussions. Stay connected and keep learning!
Reference
Creating your first MQTT request
🛠 EMQ Tech Blog
10 crucial KPIs: In the context of manufacturing, KPIs provide quantifiable metrics that help manufacturing companies track performance, identify areas for improvement, and make informed decisions to enhance efficiency, quality, and overall productivity. In this blog, Part 2 of the series, we will delve into the 10 crucial KPIs commonly utilized in the manufacturing industry. → Read more.
OEE stands for Overall Equipment Effectiveness, and it is an important part of lean management practices. This metric serves as a central focus for manufacturing companies as a universally accepted gauge and benchmark for measuring productivity. → Read more.
ISA-95 standards: This blog will explore the fundamental concepts of the ISA-95 standards, their importance in improving manufacturing processes, and their role in fostering cross-functional collaboration, all of which contribute to the optimization and implementation of traditional industrial operations. → Read more.
Serverless MQTT broker connection in React: This blog provides a step-by-step guide on connecting to a serverless MQTT deployment in React. With these steps, we can connect to the EMQX Cloud Serverless broker in a React application using MQTT.js. → Read more.
Securing your MQTT-based applications: NGINX Plus and EMQX Enterprise are two powerful tools that can help optimize and secure your MQTT-based applications. In this blog, we will discuss how to use the Client ID Substitution feature of NGINX Plus with EMQX Enterprise. → Read more.
🕐 Upcoming Events
Smart mobility uses advanced communication and sensing technologies to create more efficient, sustainable, and interconnected transportation systems. Join us as we discuss how MQTT (Message Queuing Telemetry Transport) significantly enables smart mobility by facilitating efficient and reliable communication between various components of a smart mobility ecosystem. → Register Now!
Join us at Code BEAM Europe, the Erlang and Elixir Conference, this year taking place in Berlin, the home of the biggest Elixir community in Europe. Code BEAM has united Erlang & Elixir developers for years to grow and progress the community in the spirit of Share. Learn. Inspire. Look forward to seeing you there. → Register Now!
⚙ EMQ Products Update
EMQX Enterprise 5.2.0 is now officially released! The most remarkable enhancement is the Flow Designer, a visual tool that allows enterprise users to easily create, test, and deploy data integrations through simple drag-and-drop actions. Moreover, we have also added data integration supports for Amazon Kinesis and Azure Event Hubs, which facilitate the integration of massive IoT device data with cloud services. → Read more.
Neuron is an industrial IoT server that can connect with diverse devices simultaneously using multiple protocols. It aims to address the challenge of accessing data from automated equipment and provide infrastructure support for smart manufacturing.
Previously, all available modules of Neuron only offered a 15-day free trial. Now you can enjoy a permanent free license with no more than 30 data tags! —>Get started now!
EMQX Cloud is an MQTT middleware for the IoT from EMQ. As the world's first fully managed MQTT 5.0 cloud messaging service, EMQX Cloud provides a one-stop O&M colocation and a unique isolated environment for MQTT services. —>Get started free!