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

cant get subscribe to work #6

Open
toni-h opened this issue Dec 15, 2016 · 6 comments
Open

cant get subscribe to work #6

toni-h opened this issue Dec 15, 2016 · 6 comments

Comments

@toni-h
Copy link

toni-h commented Dec 15, 2016

broker allways disconnects me when trying to subscribe.
i have it like this:

private onConnected()
{
console.log('Connected to broker.');
this._client.subscribe('testtopic/', {qos: 1});
}
do i make it right?

thank you

@AinoL
Copy link

AinoL commented Dec 16, 2016

What broker are you using for testing?

@toni-h
Copy link
Author

toni-h commented Dec 16, 2016

im using broker.mqttdashboard.com port 8000

http://www.hivemq.com/demos/websocket-client/

any idea? do u think theres something wrong with this broker?
can test another right now because im not in home.

thank you

@AinoL
Copy link

AinoL commented Dec 19, 2016

Are you using the same clientId for multiple clients? That will cause a client takeover and a disconnect.

@toni-h
Copy link
Author

toni-h commented Dec 19, 2016

no im not using. its odd thing that this broker doesnt work. i tried atleast like 3 diffrent brokers and finally found broker that works: test.mosquitto.org
i have no idea why this is the case.

@nikhil-jaunjal
Copy link

hi,
I am facing same issue. We are using personalized broker & multiple client ids.
With same configuration, everything was working fine in node while in angular 7, it is giving me above issue.
Please let me know if you have any solution. or alternate option for ng2-mqtt.

@Len0re
Copy link

Len0re commented Mar 19, 2019

Usually this happens when something goes wrong with your settings. Try using onConnectionLost() to see if there's any error. Something like

onConnectionLost(responseObject) {
    if (responseObject.errorCode !== 0) {
      console.log('onConnectionLost:', JSON.stringify(responseObject));
    }
  }

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

4 participants