MQTT over WebSocket
Introduction
In some situations you may need to tunnel MQTT over WebSockets, the reasons for this are something like:
Using MQTT in the browser
Problems with the connection of a classic MQTT client
The Datacake MQTT Broker supports client connections via the WebSocket protocol. In this tutorial we will show you how to use this.
Connection Details
Server:
ws://mqtt.datacake.co
Port:
9001
Node-RED
If you encounter problems with the connection of an MQTT node in Node-RED, you can try to see if a WebSocket connection can solve the problem. In the following steps, we will show you how to prepare the MQTT node for connection via WebSockets.
Broker Configuration
In the following screenshot you can see how the configuration of the MQTT node in Node-RED must look like. So change the according configuration as follows.
If you enter the wss://
URL in the server address input field, the port input field is disabled. Therefore, specify the port number as a subsequent element in the server address, so:
wss://mqtt.datacake.co:9001
Last updated