ngx-mqtt icon indicating copy to clipboard operation
ngx-mqtt copied to clipboard

connectOnCreate options

Open robertmazzo opened this issue 1 year ago • 0 comments

  • [ ] I have searched for similar issues in this repository, but couldn't find one.
  • [x ] 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)
  • [x ] Bug report  
  • [ ] Feature request

Current behavior

I'm in Angular 14, and passing in an empty connection object into my Angular Service code. And I was wondering why the browser was constantly checking for a ws connection on my local port '80'. Turns out that in ngx-mqtt.js, on the _handlOnReconnect event on line 92, it appears to be retrying - event though this.options.connectOnCreate is undefined. Then in mqtt.js, it tries to keep a ws conn inside function createBrowserWebSock(client, opts)

image

Expected behavior

If the connection object is empty in the application's app.module - {} - then it should NOT attempt to connect to the local websocket.

Minimal working example of the problem with instructions

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

image

Environment


ngx-mqtt version: 9.0.5


- Broker HiveMQ

Others:

robertmazzo avatar Mar 29 '23 17:03 robertmazzo