# 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&#x20;
* 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.

![](https://2221155863-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LNA8_b8wmabHgJ0QXoJ%2F-M_tdKmS21c8E7vbaEqf%2F-M_toBXt4z62lPXKgp_i%2FBildschirmfoto%202021-05-17%20um%2012.13.13.png?alt=media\&token=eadc1ac0-bb31-4ad6-9817-a9db6bca81a5)

{% hint style="info" %}
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:\
\
\&#xNAN;**`wss://mqtt.datacake.co:9001`**
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.datacake.de/api/internal-mqtt/mqtt-over-websocket.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
