A primer on HiveMQ Broker: Difference between revisions
No edit summary |
|||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
[[Category:MQTT Broker]] [[Category:Sparkplug]] | [[Category:MQTT Broker]] [[Category:MQTT Broker Primers]] [[Category:Sparkplug]] | ||
= Introduction = | = Introduction = | ||
HiveMQ Broker is a commercial MQTT Broker based on Java. | HiveMQ Broker is a commercial MQTT Broker based on Java. | ||
| Line 27: | Line 27: | ||
= Configuration = | = Configuration = | ||
See https://docs.hivemq.com/hivemq/latest/user-guide/configuration.html . Configuration is done by editing the files in the ''' | See https://docs.hivemq.com/hivemq/latest/user-guide/configuration.html . Configuration is done by editing the files in the '''conf''' subdirectory. | ||
For MQTT listeners configuration, see https://docs.hivemq.com/hivemq/latest/user-guide/listeners.html . | For MQTT listeners configuration, see https://docs.hivemq.com/hivemq/latest/user-guide/listeners.html . | ||
== WebSockets == | == WebSockets == | ||
In order to allow the MQTT broker be accessed via WebSockets, use the following in config.xml: | In order to allow the MQTT broker be accessed via WebSockets, use the following in '''config.xml''': | ||
<syntaxhighlight lang="xml"> | <syntaxhighlight lang="xml"> | ||
| Line 54: | Line 54: | ||
</hivemq> | </hivemq> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Note that you cannot use port 8080 in the default configuration, because it us occupied by the HiveMQ Control Center. | Note that you cannot use port 8080 in the default configuration, because it us occupied by the HiveMQ Control Center Web UI. | ||
Restart the HiveMQ Platform after making the configuration change, and possibly open the firewall port as needed. | Restart the HiveMQ Platform after making the configuration change, and possibly open the firewall port as needed. | ||
Latest revision as of 13:06, 20 October 2025
Introduction
HiveMQ Broker is a commercial MQTT Broker based on Java.
Web site: https://www.hivemq.com/products/mqtt-broker/
Download: https://www.hivemq.com/download/ (the whole HiveMQ Platform)
Documentation: https://docs.hivemq.com/hivemq/latest/user-guide/index.html (the whole HiveMQ Platform)
Installation
See https://docs.hivemq.com/hivemq/latest/user-guide/getting-started.html . We have tested the following installation steps on Windows, with HiveMQ 4.42.0.
- Unpack the downloaded ZIP file.
- In the unpacked directory for HiveMQ, expand the bin subdirectory, the right-click run.bat, and select "Run as administrator".
- You may get an error similar to this: "ERROR! You do not have the Java Runtime Environment installed, please install Java JRE from https://adoptium.net/?variant=openjdk21".
- Visit https://adoptium.net/temurin/releases and download the .MSI for Windows.
- Run the downloaded installer, keeping all defaults.
- In the unpacked directory for HiveMQ, expand the bin subdirectory, the right-click run.bat, and select "Run as administrator".
- The HiveMQ should now start, showing various log messages in the console window.
This is now an insecure HiveMQ deployment. Any MQTT client can connect to the broker with a full set of permissions. The MQTT broker is accepting TCP connections on port 1883.
You can access the HiveMQ Control Center on http://localhost:8080/ . The default username is admin, the default password is hivemq.
Press Ctrl+C in the console window to stop HiveMQ.
The HiveMQ platform will not start by itself when the computer is restarted. Repeat the run.bat step in order to start it again.
Configuration
See https://docs.hivemq.com/hivemq/latest/user-guide/configuration.html . Configuration is done by editing the files in the conf subdirectory.
For MQTT listeners configuration, see https://docs.hivemq.com/hivemq/latest/user-guide/listeners.html .
WebSockets
In order to allow the MQTT broker be accessed via WebSockets, use the following in config.xml:
<?xml version="1.0"?>
<hivemq xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<listeners>
<websocket-listener>
<port>8000</port>
<bind-address>0.0.0.0</bind-address>
<path>/mqtt</path>
<name>my-websocket-listener</name>
<subprotocols>
<subprotocol>mqttv3.1</subprotocol>
<subprotocol>mqtt</subprotocol>
</subprotocols>
<allow-extensions>true</allow-extensions>
</websocket-listener>
...
</listeners>
...
</hivemq>
Note that you cannot use port 8080 in the default configuration, because it us occupied by the HiveMQ Control Center Web UI.
Restart the HiveMQ Platform after making the configuration change, and possibly open the firewall port as needed.