eclipse-paho / paho.mqtt.javascript

paho.mqtt.javascript
Other
1.16k stars 466 forks source link

wss connection interrupted error in firefox, works in chrome #231

Open lordmundi opened 4 years ago

lordmundi commented 4 years ago

I'm using the latest paho-mqtt.js from master and i'm testing it against the server at test.mosquitto.org on port 8081. In chrome, everything works fine, but in firefox I get:

The connection to wss://test.mosquitto.org:8081/mqtt was interrupted while the page was loading.

I've tried putting the connection kickoff at window onload instead of via a connect button, but got the same error in firefox.

Curiously, if I change to an http server instead of https and change the code to not use "useSSL" in the connect options (along with switching to port 8080), then everything works fine in firefox. It is only when https / wss is being used that I keep getting this error and can't get any connect / subscription to work in firefox.

This is using Firefox 78.4.1esr (32-bit)

jonjonarnearne commented 3 years ago

I have the exact same issue. You can work around it by setting: "network.http.spdy.websockets" to FALSE in about:config.

But it should probably be fixed.

jonjonarnearne commented 3 years ago

This seems to be an issue with the mosquitto/libwebsockets

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

mike-sandstrom commented 3 years ago

any updates to this, I also was able to fix in firefox by setting "network.http.spdy.websockets" to FALSE in about:config. I saw Roger, one of the mosquitto maintainers, plans on moving away from libwebsockets.

However, another fix is to remake libwebsockets but without http2 support. I have yet to do this however, and have never built a dependency from source so it should be interesting haha.

tombjarne commented 2 years ago

Fast forward a year later... any news on this? The issue apparently still persists. I can't rely on users changing their config settings 😅 What did you guys do to resolve the issue?

romor commented 2 years ago

I resolved it as posted here: https://github.com/eclipse/mosquitto/issues/1211#issuecomment-958137569

Thus, by installing a libwebsockets version compiled with http2 support disabled.