Skip to content

Connection to MQTT server over WebSocket fails from web browser #1374

@epieffe

Description

@epieffe

Describe the bug
Connection to Zilla MQTT server over WebSocket fails from web browser.

The same javascript code executed on nodejs, outside a web browser, connects successfully.

To Reproduce
To quickly reproduce the issue I created a GitHub repo with a compose.yaml file that starts Zilla with Kafka and a simple index.html page that uses MQTT.js to connect to the MQTT server. All the steps to reproduce the problem are described in the README:

https://github.com/epieffe/zilla-mqtt-ws-test

In short:

  1. Start Zilla with MQTT and WebSocket bindings
  2. Connect to the MQTT server from a web browser
  3. The connection fails

Expected behavior
The web browser successfully connects to Zilla MQTT server.

Additional context
I ran the same index.html with the EMQX MQTT broker and it successfully connects, both on Firefox and Google Chrome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions