Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not connect to WSS with Web GUI, but with Desktop and CLI it works #1572

Open
Zerogiven opened this issue Jan 24, 2024 · 3 comments
Open
Assignees
Labels
help wanted Extra attention is needed web MQTTX Web

Comments

@Zerogiven
Copy link

Describe the problem you Confuse

No idea why i can't connect from the web interface...

More detail (optional)

I tried to use only secure connections. After some problems i've got it working to connect from mqttx-cli and desktop. Than i tried the web gui which only says reconnecting and no log on the mosquitto server. Of course i've tried the insecure option for my self signed certificate :) So there is not such nice log view in the web app by default, can i turn this on?

Maybe i should say my mosquitto setup is also inside a docker container. For example i've also zigbee2mqtt as docker container which connects successfully. However, this is what i've tried:

  • Connect from local to broker by mqttx-cli

    • mqttx conn -l mqtts -h 'x.x.x.x' -p 8883 -u 'mqtt' -P 'xxx' --insecure --debug
      • mqtts = success
      • wss = success
  • Connect from local to broker by mqttx desktop

    • mqtts = success
    • wss = success
  • Connect from docker to broker by mqttx-cli

    • mqttx conn -l mqtts -h 'x.x.x.x' -p 8883 -u 'mqtt' -P 'xxx' --insecure --debug
      • mqtts = success
      • wss = success

At least i've tried to edit the docker mqttx-cli container and i added there also the cli. So i have mqttx web and cli inside the same container:

  • cli mqtts = success
  • cli wss = success
  • web wss = failure

I also tried the default mosquitto clients, also from local and docker container, all with success. Only special thing that i had to point to my ca.crt.

So my last hope was to put my ca.crt inside the mqttx-web container, but without success. Of course it worked for mqttx-cli that i had not to use "--insecure" anymore, but at the web still no connection. And i'm really wondering why the mqtt broker does not get any connecting signal :/

This driving me crazy maybe someone can help me how i can figure it out :)

Just tell me if you need some more informations :)

cheers

@Zerogiven Zerogiven added the help wanted Extra attention is needed label Jan 24, 2024
@github-project-automation github-project-automation bot moved this to Backlog in MQTTX Jan 24, 2024
@ysfscream ysfscream self-assigned this Jan 25, 2024
@ysfscream ysfscream added the web MQTTX Web label Jan 25, 2024
@ysfscream
Copy link
Member

Hello, @Zerogiven

Given your connection issues, I would suggest that you connect to a public MQTT Broker using the MQTTX Web client, such as EMQX Broker. This can help us determine whether the issue lies with the client or server.

You can try connecting to wss://broker.emqx.io:8084, a publicly available MQTT Broker. I have just tested this, and it is working fine. If you can successfully connect to this public broker, it would indicate that your client configuration is likely correct, and we can then focus on your server-side configuration.

If you encounter problems even when connecting to the public broker, it could suggest that the issue is on the client side. In this case, you may need to check your network settings or browser security configurations.

Additionally, I'm curious about how you're using the MQTTX Web client. Are you using the publicly available online version, or have you deployed it using Docker? We can help us figure out the issue more accurately.

If you can provide the results of connecting to the public broker and details of how you use the MQTTX Web client, it will be easier to find the problem and help you further.

Best regards.

@Zerogiven
Copy link
Author

Hi,

I've tested the public broker and it's working fine. It's all dockerized at my environment :)

So, my broker (eclipse mosquito) is a docker container too.

Here is a small graphic from my environment:
Unbenanntes Diagramm drawio

All green lines are successfull connections to the broker with TCP and Websocket both with SSL.

But like i said, if i install the alpine linux mosquitto-client inside "mqttx-web" container i can successfully connect to the broker from the cli.

@outofsight
Copy link

outofsight commented Mar 10, 2024

I think I'm facing the same issue. I deployed EMQX and MQTTX-Web with the same docker-compose project, with few networks in common (a bridged network and an overlay network).

I can connect to EMQX from "outside" with several clients and several protocols (including ws/wss), I can connect MQTTX-Web to internet brokers with wss, but I can't connect MTTX-Web to EMQX with any address/network.

My MTTX-Web is behind a Caddy reverse proxy.

Did you find any solution?

EDIT. I think I found. First the mqtt broker address should be an address resolvable/routable by the browser, not by the mqttx-web container. Second, if mqttx-web application is accessed with TLS/https, also the broker should be accessed with TLS/wss and not ws.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed web MQTTX Web
Projects
Status: Backlog
Development

No branches or pull requests

3 participants