Getting Started with HiveMQ Cloud
HiveMQ Cloud offers different plans to help you develop, test, deploy, and scale your IoT use cases without the large investment and complexity of maintaining your own infrastructure.
Sign Up and Log In on the HiveMQ Cloud Portal
No matter which type of plan you choose, the first step of your journey is to navigate to console.hivemq.cloud.
The first time you use HiveMQ Cloud, you need to create login credentials:
-
On the HiveMQ Cloud Portal dialog, switch to the Sign Up tab and sign up with the method of your choice.
You can use your GitHub, Google, or LinkedIn account, or your email address to sign up and log in. -
HiveMQ Cloud automatically sends a confirmation email to the email address you provided.
If you signed up with your email address, use the link in the confirmation email to verify your email address.
If you do not receive a confirmation email, contact cloud@hivemq.com and ask us to send the email again. |
To complete the sign-up, you are asked to enter basic contact details to complete your user profile: Fill in the contact form and select Continue:
After the initial sign up, you can log in to HiveMQ Cloud directly.
If you selected email for your sign in method and forget your password, use can use the Don’t remember your password option to create a new password.
After a verification email, a Change Password dialog where you can create a new password is provided.
A notification window confirms that your password is successfully updated. Return to the Log In tab, enter your new password, and select Log In. |
When you set up a HiveMQ Cloud account, HiveMQ Cloud automatically creates an organization for you. HiveMQ Cloud organizations facilitate collaboration. To learn more, see HiveMQ Cloud Organizations
Choose the HiveMQ Cloud Plan You Need
Once you sign up and log in, a page to select the type of HiveMQ Cloud package you want to use opens.
For a detailed overview of the different features each HiveMQ Cloud plan offers, see the Compare Features section of the Create Cluster page. |
Pick Your Quick Start Guide
Based on the plan you select, follow one of our step-by-step start-up guides:
HiveMQ Cloud Serverless Plan - Quick Start Guide
This guide gets you started with the HiveMQ Cloud Serverless FREE plan in a few easy steps:
You can use the HiveMQ Cloud Serverless FREE plan at absolutely no cost. Our Serverless cluster is the perfect way to learn and experiment with MQTT and HiveMQ Cloud.
Here are the details:
-
Basic MQTT broker features.
-
Shared MQTT platform.
-
100 MQTT device connections at no cost to you.
-
No credit card required. Cancel anytime.
-
10 GB data traffic per month.
-
Full support for MQTT 3.1, 3.1.1, and 5.0
-
MQTT over TLS/SSL
-
Basic authorization rules
-
WebSocket support
-
Begin immediately with our easy-to-follow quick-start guide.
When you are ready to try out testing and small-scale production, create a new cluster and select the HiveMQ Starter plan 15-day free trial. For step-by-step instructions, see the HiveMQ Cloud Starter Plan Quick Start Guide. For information on HiveMQ Cloud Professional and Enterprise plans, contact us. We are happy to walk you through all the options. |
Create Cluster - HiveMQ Cloud Serverless Plan
-
To get started with a HiveMQ Cloud Serverless cluster, select Create Serverless Cluster on the HiveMQ Cloud Serverless card.
Within moments, your free HiveMQ Cloud cluster is running and ready.
-
To view cluster information or access the area where you define the credentials that your MQTT clients use to connect to the cluster, select Manage Cluster.
The Cluster Details overview for your HiveMQ Cloud Serverless cluster opens.
View Cluster Details - HiveMQ Cloud Serverless Plan
The Overview tab of the Cluster Details page outlines key information for the selected cluster.
The information and actions available on the Overview tab of the Cluster Details page vary based on the HiveMQ Cloud plan type of the cluster. |
Cluster Information - HiveMQ Cloud Serverless Plan
Item | Description |
---|---|
Name |
The automatically generated unique identifier of the selected cluster. |
Current Plan |
The type of HiveMQ Cloud package the cluster runs. The following cluster types are possible:
|
Current Tier |
The subscription model of the selected plan. The available tiers vary based on the type of plan. The following tiers are possible:
|
Cloud Provider |
The cloud service provider on which the HiveMQ Cloud cluster is located. Currently, HiveMQ Serverless clusters are automatically located on Amazon Web Services (AWS). |
Cluster URL |
The unique URL of the selected cluster. |
Port |
The secure port that your MQTT clients use to connect to your HiveMQ Cloud cluster. |
WebSocket Port |
The secure port that your MQTT clients use to connect to your HiveMQ Cloud cluster using WebSocket. |
TLS MQTT URL |
The address on which your MQTT clients establish the secure MQTT connection to your HiveMQ Cloud cluster with MQTT. |
TLS WebSocket URL |
The address on which your MQTT clients establish the secure MQTT connection to your HiveMQ Cloud cluster with WebSocket. |
Current Usage - HiveMQ Cloud Serverless Plan
Item | Description |
---|---|
MQTT Client Sessions |
The current number of MQTT connections used in this billing period and the maximum number of concurrent MQTT connections the selected HiveMQ Cloud Serverless cluster allows. Actual usage can vary slightly from the cluster capacity value shown.
|
Data Traffic |
The current volume of data consumed in this billing period and the total volume of data the selected HiveMQ Cloud package includes per month. Actual usage can vary slightly from the cluster capacity value shown.
|
Available Actions - HiveMQ Cloud Serverless Plan
Item | Description |
---|---|
What is included in my plan? |
View the plan type and available features for the selected HiveMQ Cloud cluster. |
Delete Cluster |
After a confirmation request, permanently deletes the selected HiveMQ cloud cluster and all data on the cluster. This action cannot be undone. |
Contact Support |
Opens a dialog with resource links and access to the HiveMQ Support portal. |
Create Access Credentials - HiveMQ Cloud Serverless Plan
To connect MQTT clients to your cluster, you need to define the MQTT credentials that allow the clients to access the cluster.
-
To create an MQTT credential, enter a Username, Password, and Permissions level in the Access Credentials area of the Access Management tab of your HiveMQ Cloud cluster.
Select Create Credential to add the set of credentials.
The Access Credentials area adjusts to list all credentials that you create for the selected cluster.
You can add and delete MQTT credentials for your HiveMQ Cloud cluster as needed. |
Add Topic Filter-based Permissions - HiveMQ Cloud Serverless Plan
If desired, you can define custom topic filter-based permissions for use in your access credentials. When you add an MQTT topic filter to a permission, the HiveMQ broker applies the defined permission level only to topics that match the configured topic filter.
-
To create a custom permission, enter a Name, Description, and Permission Type for the permission in the Permissions area of the Access Management tab. HiveMQ uses the name you assign as the permission identifier.
In the Topic Filter field, enter the MQTT topic filter to which the permission applies. The topic filter can include wildcards.
Select Create Permission to add the custom permission.
The Permissions area adjusts to display all available permissions (standard and custom).
To see how your newly-configured HiveMQ Cloud Serverless cluster works with MQTT clients, see Test Your HiveMQ Cluster.
Keep the Credentials page of your cluster open. To complete the Pub/Sub test with the MQTT CLI procedure, you need the URL, port, and MQTT credential information from the Overview and Access Management tabs. |
HiveMQ Cloud Starter Plan - Quick Start Guide
This guide shows you how to get started with a 15-day free trial of our HiveMQ Cloud Starter plan quickly and easily:
You can explore a HiveMQ Cloud Starter plan trial at absolutely no cost for 15 days. Our Starter plan provides a complete MQTT platform that is ideal for testing and small-scale production use cases.
Here are the details:
-
Dedicated MQTT platform
-
Unlimited connections
-
Up to 1MB/s data throughput
-
Client certificate authentication
-
HiveMQ Control Center support
-
REST API
-
Data streaming integrations
-
No credit card required for the 15-day trial.
-
Cancel anytime.
-
Begin immediately with our easy-to-follow quick-start guide.
Create Cluster - HiveMQ Cloud Starter Plan Free Trial
-
To get started with your HiveMQ Cloud Starter trial, select Get started for FREE on the HiveMQ Cloud Starter card.
A page to configure your HiveMQ Cloud cluster opens:
-
Name your cluster: The name of your HiveMQ Cloud cluster must be unique within your account. You can use the automatically generated cluster name or enter a name of your choice. Your cluster name can have a maximum of 15 characters and must contain lowercase letters and numbers, only.
-
Select your tier: HiveMQ Cloud offers various service levels. For your HiveMQ Starter plan trial, Production S with up to 1 MB data throughput per second is used.
-
Select your cloud service provider: HiveMq Cloud uses Amazon Web Services (AWS) and Microsoft Azure for service providers. Currently, the selection of a cloud service provider other than AWS is only available for the HiveMQ Cloud Professional and Enterprise plans.
-
Select your region: Based on your geographic location, select whether your HiveMQ Cloud cluster is located in the AWS Oregon (us-west-2) region or the _Frankfurt (eu-central-1) region.
-
Review the configuration information in the Your Selection and Starter areas.
For the HiveMQ Cloud Starter free trial, pricing applies only after the 15-day trial ends. -
After you review your configuration information, select Continue.
-
On the page that opens, enter your preliminary billing information, review and agree to the HiveMQ Terms of Service, and select Start Trial:
After your trial ends, you will be charged based on your usage at the end of each billing cycle starting on the date shown. You can cancel your HiveMQ Cloud plan at any time.
To review the billing terms and conditions that apply to each plan see, Billing. -
A card for your trial HiveMQ Cloud Starter cluster appears on the Your Clusters overview.
Cluster creation can take a few minutes. -
When the cluster creation process finishes, select Manage Cluster to view cluster information and access the area where you define connection credentials for your MQTT clients.
The Cluster Details overview for your HiveMQ Cloud Starter_ cluster opens.
View Cluster Details - HiveMQ Cloud Starter Plan
The Overview tab of the Cluster Details page outlines key information for the selected cluster.
The information and actions available on the Overview tab of the Cluster Details page vary based on the HiveMQ Cloud plan type of the cluster. |
Cluster Information - HiveMQ Cloud Starter Plan
Item | Description |
---|---|
Current Plan |
The type of HiveMQ Cloud package the cluster runs. The following cluster types are possible:
|
Region |
The geographical location of the data center on which the cluster runs. |
Cloud Provider |
The cloud service provider on which the HiveMQ Cloud cluster is located. The following providers are available:
|
Current Tier |
The subscription model of the selected plan. The available tiers vary based on the type of plan. The following tiers are possible:
|
Name |
The identifier of the selected cluster. |
Integrations |
The service integrations that are currently configured for the selected cluster. The following fully-managed integrations are available:
|
Cluster URL |
The unique URL of the cluster that HiveMQ generates automatically when the cluster is created. |
Port |
The secure port that your MQTT clients use to connect to your HiveMQ Cloud cluster. |
WebSocket Port |
The secure port that your MQTT clients use to connect to your HiveMQ Cloud cluster using WebSocket. |
Available Actions - HiveMQ Cloud Starter Plan
Item | Description |
---|---|
Customize |
Opens a dialog where you can define a custom cluster URL for the selected cluster. |
Delete Cluster |
After a confirmation request, this action permanently deletes the HiveMQ cloud cluster and all data on the cluster. This action cannot be undone. |
Contact Support |
Opens a dialog with resource links and access to the HiveMQ Support portal. |
Cluster Usage - HiveMQ Cloud Starter Plan
Item | Description |
---|---|
Hourly usage |
The current number hours used in this billing period. Actual usage can vary slightly from the value shown.
|
Normalized messages |
The current number of messages published in this billing period. For billing purposes, only PUBLISHED messages are counted. The actual message count can vary slightly from the value shown.
|
Access Management - HiveMQ Starter Plan
The Access Management tab is where you select the authentication method that controls which MQTT clients can connect to your HiveMQ Cloud cluster and define what actions the clients are authorized to perform on the cluster.
The information and actions available on the Access Management tab of the Cluster Details page vary based on the type of HiveMQ Cloud cluster. To learn more, see HiveMQ Cloud Authentication and Authorization. |
To locate your Access Management options, go to Your Clusters and select Manage Cluster for the desired cluster.
On the Cluster Details page that opens, switch to the Access Management tab.
Security Configuration - HiveMQ Starter Plan
HiveMQ Cloud provides advanced authentication and authorization mechanisms that help you safeguard your data, prevent unauthorized access, and maintain the overall security and integrity of your application.
The security configuration for your HiveMQ Starter plan cluster is divided into two sections:
-
Authentication: Defines the method HiveMQ Cloud uses to verifiy the identity of MQTT clients that connect to your HiveMQ Cloud broker. Authentication prevents unauthorized access and ensures that only trusted clients can perform actions on your cluster.
-
Authorization: Defines which actions an MQTT client is allowed to perform on your cluster. Authorization can be split into the concepts of roles and permissions.
Authentication Options - HiveMQ Cloud Starter Plan
To connect an MQTT client to your cluster, you need to define the authentication method that allows the client to access the cluster.
The HiveMQ Cloud Starter plan offers three ways to ensure that only authorized devices can connect to your MQTT broker:
Only clients that present a known access credential, client certificate, or JSON Web Token are allowed to connect and perform actions on the selected cluster. You can choose the authentication method that fits your individual business needs.
Currently, you can only implement one authentication method at a time. It is not possible to use multiple methods simultaneously. |
Authentication with Access Credentials - HiveMQ Cloud Starter Plan
HiveMQ Cloud access credentials contain a username-password pair.
Authentication with access credentials is the default authentication method in HiveMQ Cloud.
When this authentication method is active, MQTT clients must present access credentials that you have defined to connect to your HiveMQ Cloud MQTT broker.
In HiveMQ Starter plan and above, permissions are tied to roles. When you assign one or more roles to an access credential, clients that connect to your cluster with the access credential can perform all activities that the permissions associated with the roles allow. For more information, see Role Based Access Control. |
You can add and delete access credentials for your HiveMQ Cloud clusters as needed to fulfil your business needs.
For more information, see Access Credentials.
When you remove access credentials, clients that are currently connected with the credentials remain connected. During the next reconnect, the clients will no longer be able to connect to the cluster with the old credentials. |
To create an MQTT credential, select Edit in the Access Credentials area of your Security Configuration.
-
In the expanded Access Credentials area, enter a Username and Password.
-
To set the level of access and permissions the Access Credentials provide, assign a role from the Role drop-down list.
-
To add the access credential, select Save.
HiveMQ Cloud _Starter_plan and above support Role Based Access Control (RBAC) for MQTT clients. For your convenience, the HiveMQ Starter plan provides a default Allow All role that you can use to assign permissions to your credentials. The default role includes all default permissions and several additional MQTT-specific permissions. For more information, see Default Role.
|
When you create or edit a credential, the Access Credentials area automatically adjusts to display your changes.
All currently available MQTT access credentials for the selected cluster are listed in the Access Credentials area of the Access Management page.
Authentication with Client Certificate - HiveMQ Cloud Starter Plan
HiveMQ Cloud Starter plan and above support MQTT client authentication with client certificates. In MQTT, client certificate authentication can add an extra layer of security compared to other authentication methods such as username/password.
To set up client certificate authentication, select Edit in the Client Certificate area of your Security Configuration.
-
In the expanded Client Certificate area, enter a Name for the client cetificate.
-
Drag and drop or upload your public key certificate to the Key field.
-
Assign a role from the Role drop down list to set the level of access and permissions the client certificate allows.
-
Select Save to add the client certificate.
Your public key certificate provides the root Certificate Authority (CA) and allows clients to robustly prove their identity.
You can add and remove client certificates as needed to ensure secure access.
When you change your authentication method, your previously selected authentication method is overridden. Currently-connected clients can be disconnected and could need to be reconfigured. |
Authentication with JSON Web Token - HiveMQ Cloud Starter Plan
HiveMQ Cloud Starter plan and above support the use of JSON Web Tokens (JWT) for authentication of MQTT clients. JWTs are a widely adopted standard for representing claims between parties in a secure and interoperable manner.
In the JSON Web Token section, you can provide a JSON Web Key Set (JWKS) endpoint for token validation and manage a list of claims that define the parameters of access.
To set up JSON Web Token authentication, select Edit in the JSON Web Token area of your Security Configuration.
-
In the expanded JSON Web Token area, select Add JSON Web Token.
-
In the expanded JSON Web Token configuration area, enter a JWKS Endpoint.
-
In the Claims area, enter one or more Key and Value pairs.
-
Assign a role from the Role drop-down list to set the level of access and permissions the JWT allows.
When you change your authentication method, your previously selected authentication method is overridden. Currently connected clients can be disconnected and could need to be reconfigured. |
Authorization Options - HiveMQ Cloud Starter Plan
The HiveMQ Cloud Starter plan uses the concepts of Permissions and Roles to give you fine-grained control over the actions MQTT clients that connect to your HiveMQ Cloud cluster can perform.
In HiveMQ Cloud Starter plan clusters, permissions are assigned to roles. For more information, see Permission Management.
To authorize an MQTT client to perform specific actions on your HiveMQ Cloud cluster, you assign the MQTT client a role that contains the desired set of permissions.
Authorization Permissions - HiveMQ Cloud Starter Plan
Permissions define what actions (publish, subscribe) an MQTT client can perform on a per MQTT topic basis. In the HiveMQ Cloud Starter plan and above, you can define and attach one or more permissions to a role.
To create a permission, select Edit in the Permissions area of your Security Configuration.
-
In the expanded Permissions area, select Create new permission to open the permission configuration options.
-
Enter a Name for the permission.
-
Define the MQTT Topic to which the permission applies. All valid MQTT topic filters, including wildcards (+,#) are supported.
-
Add an optional Description for the permission.
-
Use the Publish / Subscribe checkboxes to select the actions the permission authorizes.
-
Use the Quality of Service checkboxes to select the level of message delivery guarantee the permission authorizes. You can select one or more of the available QoS levels: QoS 0, QoS 1, and QoS 2.
-
Use the Advanced options checkboxes to define whether the permission authorizes retained messages and shared subscriptions.
-
Select Create Permission to save your changes and add the permission to your list of available permissions.
In HiveMQ Cloud, you can enhance your MQTT topics with dynamic variables. For more information, see Dynamic Variables in MQTT Topics. |
Dynamic Variables in MQTT Topics
HiveMQ Cloud Starter plan gives you the ability to dynamically customize your MQTT topics with variables based on your authentication method. The use of dynamic variables allows for more flexible and personalized data routing.
Authentication Method | Variables | Description |
---|---|---|
Access Credentials |
|
Apply for user-specific topics. |
JWT Claims |
|
Apply for the audience, issuer, and scope respectively. |
x509 Certificate |
|
Appy for detailed certificate identification. |
Universal |
|
Apply to all authentication methods for client identification. |
Keep in mind that MQTT special characters such as # (multi-level wildcard) and + have unique functionalities in topic filters. For more information, see MQTT Topics, Wildcards, & Best Practices.
|
Authorization Roles - HiveMQ Cloud Starter Plan
Authorization in HiveMQ Cloud Starter plan and above allows you to assign one or more roles per authentication method. Each role can include one or more permissions. You define roles to group permissions in ways that match your particular use case.
To create a role, select Edit in the Roles area of your Security Configuration.
-
In the expanded Roles area, select Create new role to open the role configuration options.
-
Enter a unique Name for the role.
-
Add an optional Description of the role.
-
Select one or more permissions from the list of available permissions in the Permissions field.
-
To create the defined role, select Create Role.
Each role you create is added to the list of available roles in the Role field of the Authentication configuration area.
The Permissions list automatically contains a predefined HiveMQ Cloud Allow All permission and any custom permissions you create. to add more permissions to the list of available permissions, see Create Permissions (Starter plan and up). |
Organizations
HiveMQ Cloud organizations enable HiveMQ Cloud users to collaborate on HiveMQ clusters across one or more HiveMQ Cloud accounts.
When you create a HiveMQ Cloud account, a HiveMQ Cloud organization is automatically created for the account.
The user who creates the HiveMQ Cloud account is automatically assigned as the organization owner and has administrative rights for the organization.
To view the unique Organization ID of your HiveMQ Cloud account, select Profile in the main navigation of your HiveMQ Cloud console:
In addition to the organization associated with your own HiveMQ Cloud account, you can accept invitations to collaborate as a member of other HiveMQ organizations. To manage your organization or access other organizations that you are a part of, select Organizations in the main navigation of your HiveMQ Cloud console.
If you delete your HiveMQ Cloud user account, the organization and organization memberships associated with your account are also deleted. |
Organization Settings - HiveMQ Cloud Starter Plan
The Organizations | Settings tab displays the name of the organization to which you are currently signed in.
To manage your organization settings, you must have a running Starter or Enterprise cluster. Only the owner of an organization can define or change the name of the organization: |
If you are a part of one or more HiveMQ Cloud organizations, a list of the organizations in which you are a member displays in the top bar of the page. To switch organizations, select the name of the desired organization from the list. |
Organization Members - HiveMQ Cloud Starter Plan
The Organizations | Members tab provides the email address, status, and role for all members of the selected organization as well as management options.
To invite people to your organization, you must have a running Starter or Enterprise cluster. Only the owner of an organization can invite people to the organization: |
The actions that are visible on the Members tab vary based on your role in the organization. For example, the Invite and Remove actions are only available for the Owner role and the Leave action is only available for the Admin role.
Item | Description |
---|---|
The email address of the organization member. The email address must be unique within the selected organization. |
|
Status |
Shows whether the user successfully joined the selected organization. |
Role |
The set of permissions the member has in the selected organization.
|
Invite Organization Members - HiveMQ Cloud Starter Plan
The owner of the organization can invite an unlimited number of members to join their organization.
To invite people to your organization, you must have a running Starter or Enterprise cluster. |
To add a member to your organization, select Invite, enter the email address of the team member with whom you want to collaborate, and select Send Invite.
-
Users who already have a HiveMQ Cloud account are added to the organization immediately without any further email notification or action required.
-
Users who do not yet have a HiveMQ Cloud account receive an enrollment email. As soon as the new user completes the HiveMQ Cloud signup, the user is automatically added to the organization.
Remove Organization Members - HiveMQ Cloud Starter Plan
The owner of an organization can remove existing members from the organization at any time. To remove people from your organization, you must have a running Starter or Enterprise cluster. You cannot remove a member from an organization of which you are not the owner.
To immediately remove a member from your organization, select Remove for the desired member.
After a confirmation request, the Remove action deletes the member from the selected organization. Removal from an organization does not affect other organization memberships of the user or the HiveMQ Cloud account of the removed member.
It is not possible to remove the owner of an organization. |
Leave Organization - HiveMQ Cloud Starter Plan
Members can leave any organization that they do not own at any time.
To immediately leave an organization in which you have an Admin role, select Leave next to your entry on the Members tab.
After a confirmation request, the Leave action removes you from the selected organization only. The Leave action deletes the organization from the list of organizations you can access but does not affect your memberships in other organizations or your HiveMQ Cloud account.
Test Your New HiveMQ Cloud Cluster
Once you create your MQTT credentials, you are ready to connect some MQTT clients and explore basic MQTT functionality.
This guide walks you through two ways to try out the connection to your HiveMQ Cloud instance:
Pub/Sub Test with the HiveMQ WebSocket Client
Your HiveMQ Cloud package also supports MQTT over WebSocket on port 8884. Once you create your HiveMQ Cloud cluster you can use the public HiveMQ WebSocket client to test the connection. The graphical view of the public WebSocket client provides a convenient way to explore and experiment with MQTT functionality.
Access the HiveMQ WebSocket Client
To get started with the HiveMQ WebSocket Client, switch to the Web Client tab of your HiveMQ Cloud cluster.
Connect to Your HiveMQ Cloud Instance
-
In the Client Connection Settings area, enter the set credentials you want to use for the web client connection.
You can use one of the Active MQTT Credentials listed on your Access Management tab or create a new set of automatically generated connection credentials.-
To connect with credentials that you previously created, enter one of your active credentials and select Connect Client to establish the connection.
The screen adjusts to show that the Web Client is connected.
-
To create and connect with automatically generated credentials, select the Connect with Generated Credentials option.
A dialog opens with your autogenerated username and password.Record your new credential information in a secure location, and select Create and Connect to establish the connection.
-
Pub/Sub Test with the HiveMQ Web Client
-
In the Topic Subscriptions area, enter a topic name and select a Quality of Service (QoS) level for the subscription. The default QoS level is 0.
To add the subscription, select Subscribe.
To subscribe to additional topics, repeat the process.If desired, use the Change Color option to color code the subscription with a color of your choice.
-
In the Publish Message area, enter the destination topic, the desired message payload, and quality of service level (QoS). The default QoS level is 0.
To publish the message to your HiveMQ Cloud instance, select Publish.
The message payload, topic, QoS level, and timestamp of each message sent to the Web Client on the defined subscriptions display immediately.
For more information on MQTT over WebSockets, see the HiveMQ MQTT Essentials special edition on WebSockets.
Pub/Sub Test with the MQTT CLI
We use the MQTT CLI for ease of use and to simplify the explanation of this example procedure.
However, you are free to use whichever tool and method you prefer. For instructions with other tools, check the tooling information listed on the Getting Started tab of the Cluster Details page of your HiveMQ Cloud console. |
Connect an MQTT Client
-
To start the MQTT CLI in shell mode, open a terminal window and enter the following command:
mqtt sh
The MQTT CLI starts and displays a list of useful options and commands.
-
To connect to your HiveMQ Cloud cluster, type the following command with the appropriate information from your Clusters page and press enter:
con -h <cluster-url> -p <port-number> -s -u <mqtt-credentials-username> -pw <mqtt-credentials-password>
Information about the HiveMQ Cloud connection displays.
This is your first connected MQTT client.HiveMQ Cloud only allows secure TLS connections. Adding an -s flag to the connect command opens a secure connection to the MQTT Broker with the default SSL configuration. -
To create another connected client and test your cluster, open a second terminal window (keep your original terminal window open) and enter the following command once more:
mqtt sh
-
Copy and paste the connection command that you created in the first window to the second window and press enter.
Information about the second HiveMQ Cloud connection displays.
This is your second connected MQTT client.
Publish/Subscribe Test
-
In the terminal window of the second MQTT client, enter:
sub -t testTopic -s
This command subscribes the second MQTT client to all messages that are published to the topic testTopic.
In shell mode, adding the -s flag to the command blocks the MQTT CLI console so that the incoming messages are printed out to the user. -
In the first terminal window, enter:
pub -t testTopic -m Hello
This command makes the first MQTT client a publisher and publishes the message Hello with the topic testTopic.
The message Hello appears immediately in the terminal window of the second MQTT client. -
To publish another message, enter the following command in the first terminal window:
pub -t testTopic -m Goodbye
This command publishes the message Goodbye with the topic testTopic.
The message Goodbye appears immediately in the terminal window of the second MQTT client.