poblabs / weewx-belchertown

A clean and modern weewx skin with real time streaming updates, forecast data and interactive charts. View it in action at BelchertownWeather.com
https://belchertownweather.com
GNU General Public License v3.0
211 stars 111 forks source link

Bug in Mosquitto/MQTT manifested in Firefox #731

Closed gldickens3 closed 2 years ago

gldickens3 commented 3 years ago

Hello,

I just upgrade from Debian 10 Buster to Debian 11 Bulleye and I discovered that MQTT stopped working with WeeWX/Belchertown in Firefox. That is, Chrome, Safari Chromium and Konqueror work fine but Firefox will not do live data updates. Debian 10 used Mosquitto 1.5.7-1 while Debian 11 uses Mosquitto 2.0.11-1. Apparently, the consensus is that there is a bug in the Mosquitto libraries that makes Firefox use HTTP/2 when it should be using HTTP/1.1 for websockets. You can read about the bug here (with a fix suggested):

https://support.mozilla.org/en-US/questions/1324001

The suggested fix is to set "network.http.spdy.websockets" to false. The only problem with the suggestion is that most of our website visitors will not be motivated to search for a solution to this and they will conclude that WeeWX/Belchertown simply does not work.

Also, this bug is further discussed here:

https://github.com/eclipse/mosquitto/issues/1211

On August 14, jmico noted: "The current Debian 11 package of Mosquitto (2.0.11-1) has this issue. TLS webockets work fine on Chrome, but does not on Firefox (unless "network.http.spdy.websockets" is set to false).

So, the bottom line is that WeeWX/Belchertown/MQTT does not work with Firefox clients for the current stable version of Debian 11. Does anybody have any insight as to the best way to manage this problem?

Thanks,

Gordon

ebnerjoh commented 3 years ago

Strange, since about 2 weeks I have a similar issue, that the mqtt integration is also not working anymore. But for myself its happening on all browsers.

If I set the same Listener on my nodered then everything is working, I receive the values.

ebnerjoh commented 2 years ago

Hi, anyone with the same issue?

My MQTT Websocket Integration stopped working somewhen in November/December and I was not able to figure out why.

Weewx is still publishing MQTT as I am using this also for my HomeAutomation.

James-76 commented 2 years ago

Yes.

It is reportedly due to the packaging of the libwebsockets18 package in Debian 11 Bulleye. You can find it discussed at https://github.com/eclipse/mosquitto/issues/2322

I downgraded mosquitto and libwebsockets18 on my Raspberry Pi and got it working successfully.

wget https://repo.mosquitto.org/debian/pool/main/libw/libwebsockets/libwebsockets18_4.2.1-mosquitto1~buster1_armhf.deb
wget https://repo.mosquitto.org/debian/pool/main/m/mosquitto/mosquitto_2.0.12-0mosquitto1~bullseye1_armhf.deb

root@pi:/home/pi# apt list | grep mosquitto | grep install
libmosquitto1/stable,now 2.0.11-1 armhf [installed,automatic]
libwebsockets18/now 4.2.1-0mosquitto1~buster1 armhf [installed,local]
mosquitto-clients/stable,now 2.0.11-1 armhf [installed]
mosquitto/now 2.0.12-0mosquitto1~bullseye1 armhf [installed,local]
ebnerjoh commented 2 years ago

I am not sure how this affects me.

But on the WeeWX Server I do not have Mosquitto and not Libwsockets installed. On the Weewx Server I am just using the MQTT Plugin for Weewx.

On the other side I have a RPI for the /pi theme, but also here I havent mosquitto and not Libwsockets installed.

But yes, then I have a Mosquitto Server on a Unraid Docker installed where weewx is sending the mqtt messages and where my /pi was connecting with websockets. Could it be that this might the reason?

ebnerjoh commented 2 years ago

Ok, I think I found the issue. It is the mosquitto server. Downgraded now to 2.10 and it is working again

ebnerjoh commented 2 years ago

Strange, I upgraded now mosquitto and it is still working.

Anyhow, I think the bug can be closed as it is not related to belchertown skin.

gldickens3 commented 2 years ago

OK, I think that I have figured this out. That is, for some unknown reason Debian stopped publishing libwebsockets18 in the Debian Bullseye repos although libwebsockets18 is required by mosquitto. Nevertheless, libwebsockets18 has always been available in the official mosquitto repos here:

https://mosquitto.org/blog/2013/01/mosquitto-debian-repository/

After I added the mosquitto repo to /etc/apt/sources.list.d and then ran apt update && apt upgrade then mosquitto 2.0.14 was installed along with libwebsockets18 4.2.1 and everything started working properly again with Firefox, etc.

So, adding the official mosquitto repo solved this problem completely for me.

The previous version of Debian, Buster, included libwebsockets18, however, Debian, for some unknown reason, apparently dropped libwebsockets18 in Bullseye thereby creating this bug such that mosquitto does not work with Firefox in Bullseye. Nevertheless, the problem is easily solved by simply adding the official mosquitto repo to your Debian Bullseye installation.

FYI,

Gordon

gldickens3 commented 2 years ago

This issue has been resolved and is therefore closed.