ng2-mqtt
ng2-mqtt copied to clipboard
cant get subscribe to work
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
What broker are you using for testing?
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
Are you using the same clientId for multiple clients? That will cause a client takeover and a disconnect.
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.
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.
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));
}
}