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

MQTT.js not working on IOS 15.2 in all iPhone browsers. #1588

Closed
PogoDigitalism opened this issue Mar 19, 2023 · 6 comments
Closed

MQTT.js not working on IOS 15.2 in all iPhone browsers. #1588

PogoDigitalism opened this issue Mar 19, 2023 · 6 comments

Comments

@PogoDigitalism
Copy link

I have tried to enable and disable multiple potentially influental experimental js features on the iPhone. But nothing has proven to be succesful. (One of them that i disabled was NSURLSession WebSocket.

@PogoDigitalism
Copy link
Author

PogoDigitalism commented Mar 19, 2023

The code:
const client = mqtt.connect('mqtt://KEY@NAME.cloud.shiftr.io', { clientId: 'rmc_mechatronics' });

I am using MQTT.js version 4.0.1.

KEY and NAME are different in the code. I just hid them here. This code works on my computer browser.

@nosovk
Copy link
Contributor

nosovk commented Mar 22, 2023

There are lots of legacy dependencies in this lib now, and due to that we had lots of issues into bundling it into web apps. Finally, we moved to https://github.com/shanewholloway/js-u8-mqtt, and it works both on IOS Safari and Desktop Safari. We do pretty extensive testing, and actually we were not able to get MQTT.JS to work in browser correctly within any bundler (vite, rollup, webpack). Only using prebuild version seems to be working in browser. Check: https://github.com/mqttjs/MQTT.js#via-cdn It was actually working, and we have one project where we lazy load mqtt.js from CDN upon request. But it's actually wasn't pretty, and for newer projects we just moved to u8-mqtt.
But at backend MQTT.JS works like a charm 🤷‍♂️

@robertsLando
Copy link
Member

@nosovk I recently started helping maintaining this library. If someone of you would like to help fixing this issue I will be more then happy to review a PR

@nosovk
Copy link
Contributor

nosovk commented Jul 5, 2023

We currently moved to library above and not using mqtt.js, but I'll check current issues on a weekend.

@robertsLando
Copy link
Member

MQTT 5.0.0 BETA is now available! Try it out and give us feedback: npm i mqtt@beta. It may fix your issues

@robertsLando
Copy link
Member

I have fixed Browser docs by adding webpack and vite setup. Check them out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants