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

ws does not work in the browser. Browser clients must use the native WebSocket object (7.0.13) #162

Closed
3 of 5 tasks
PaulMoore-PaymentsFoundry opened this issue Aug 21, 2020 · 7 comments

Comments

@PaulMoore-PaymentsFoundry
  • I have searched for similar issues in this repository, but couldn't find one.
  • I have read the README and have a basic understanding how angular works.

I'm submitting a...

  • Regression (a behavior that used to work and stopped working in a new release)
  • Bug report  
  • Feature request

Current behavior

Throws a "ws does not work in the browser. Browser clients must use the native WebSocket object". Does not happen in 7.0.12

Expected behavior

Connects to MQTT using websockets.

Minimal working example of the problem with instructions

What is the motivation / use case for changing the behavior?

Environment


ngx-mqtt version: 7.0.13


- Broker VerneMQ

Others:

@AlxZchk
Copy link

AlxZchk commented Aug 22, 2020

Afaik that's the issue with mqtt.js 4.2.0 mqttjs/MQTT.js#1141. It should not be the case with ngx-mqtt since what I can see from the code, it uses 4.1.0. But for some reason when you install the package turns out it uses 4.2.0 🤷

@YoDaMa
Copy link

YoDaMa commented Aug 24, 2020

release 4.2.1 (#1149) fixes this.

@ccravens
Copy link
Contributor

ccravens commented Aug 25, 2020

I can confirm that manually updating to 4.2.1 in package-lock.json and re-running npm install fixes the issue, how can we specify it to pull 4.2.1 w/o having to manually edit package-lock.json?

@nosovk
Copy link
Contributor

nosovk commented Aug 28, 2020

we use exact version in nxg-mqtt
https://github.com/sclausen/ngx-mqtt/blob/master/projects/ngx-mqtt/package.json#L12
as you see we do not use ^
Just don't add mqtt as dependancy in yours angular project. Then peed dependency will take correct version.

@markdegrootnl
Copy link

It seems the version on npm has a dependency on mqtt exact version 4.2.0.
I've downloaded the package using npm pack ngx-mqtt which gives me ngx-mqtt-7.0.13.tgz.

After extracting, these are the dependencies in package.json:

"dependencies": {
  "mqtt": "4.2.0",
  "tslib": "^1.10.0"
},

@sclausen
Copy link
Owner

I just published v7.0.14 with [email protected].

@markdegrootnl
Copy link

Great @sclausen, thanks for the quick response!
I've just tested installed the new version. The mqtt dependency is correct and the error in the browser is gone.

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

7 participants