WebSocket MQTT connection fails (HTTP 400 Bad Request) for MQTT 3.1 clients #15001
-
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
|
We need an executable way to reproduce. |
Beta Was this translation helpful? Give feedback.
-
|
Thank you, @michaelklishin. Here is a minimal repro consisting of a RabbitMQ server installation (in a Docker container) and a short client MQTT connection script (written in cross-platform Swift). This entire repro may be run on macOS, on Linux or under WSL in Windows. For the MQTT v3.1 vs v3.1.1 tests, I used the Swift working group's official (and widespread) NIO and MQTT client libraries. To keep things simple, the two sample client apps use the exactly same code (except for the referenced MQTT client library version and the client ID). Setup procedure for minimal reproStep 1: Install and configure RabbitMQ 1b. Install mqtt and web_mqtt plug-ins 1c. Add a user Step 2: Install Swift on the client (on the same host computer; WSL is fine) Running the tests (Linux, macOS or WSL)MQTT v3.1 WebSocket test $ cd TestMqtt3_1 The client will output:
And RabbitMQ (i.e. its terminal instance or log) will output:
MQTT v3.1.1 WebSocket test $ cd ../TestMqtt3_1_1 The client will output:
And RabbitMQ (i.e. its terminal instance or log) will output:
|
Beta Was this translation helpful? Give feedback.
-
|
One quick addition: To be clear, the sample client code works under RabbitMQ v3.11 without incident. It's just the newer releases of RabbitMQ which break the MQTT v3.1 (over WebSocket) client. To demonstrate this, swap in RabbitMQ v3.11.x in step 1 of the above repro. And to break the MQTT v3.1 sample client again, stop that container and upgrade to RabbitMQ v4.2.1. |
Beta Was this translation helpful? Give feedback.
-
|
That's because the check was added with the MQTT 5 work, and We do test it against v3.1.0 but perhaps the A test for this could be done just sending an HTTP request to establish a Websocket connection with the protocol set to |
Beta Was this translation helpful? Give feedback.



I don't have a Web MQTT setup handy, but this PR should address this issue:
#15008