mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Bugfix connecting state
This commit is contained in:
parent
1a0d1ce173
commit
3b24d81db5
@ -87,9 +87,7 @@ module.exports = function(RED) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Connect to server if needed and subscribe
|
// Connect to server if needed and subscribe
|
||||||
node.status({fill:"grey",shape:"ring",text:"connecting"});
|
const subscribe = () => {
|
||||||
|
|
||||||
function subscribe() {
|
|
||||||
node.log('subscribing to: '+node.topic);
|
node.log('subscribing to: '+node.topic);
|
||||||
node.client.subscribe(node.topic, node.subscribeHeaders, function(body, headers) {
|
node.client.subscribe(node.topic, node.subscribeHeaders, function(body, headers) {
|
||||||
var newmsg={"headers":headers,"topic":node.topic}
|
var newmsg={"headers":headers,"topic":node.topic}
|
||||||
@ -104,6 +102,7 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!node.server.connected) {
|
if (!node.server.connected) {
|
||||||
|
node.status({fill:"grey",shape:"ring",text:"connecting"});
|
||||||
node.client.connect(function(sessionId) {
|
node.client.connect(function(sessionId) {
|
||||||
subscribe();
|
subscribe();
|
||||||
}, function(error) {
|
}, function(error) {
|
||||||
@ -176,8 +175,8 @@ module.exports = function(RED) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Connect to server if needed
|
// Connect to server if needed
|
||||||
node.status({fill:"grey",shape:"ring",text:"connecting"});
|
|
||||||
if(!node.serverConfig.connected) {
|
if(!node.serverConfig.connected) {
|
||||||
|
node.status({fill:"grey",shape:"ring",text:"connecting"});
|
||||||
node.client.connect(function(sessionId) {}, function(error) {
|
node.client.connect(function(sessionId) {}, function(error) {
|
||||||
node.status({fill:"grey",shape:"dot",text:"error"});
|
node.status({fill:"grey",shape:"dot",text:"error"});
|
||||||
node.warn(error);
|
node.warn(error);
|
||||||
@ -250,8 +249,8 @@ module.exports = function(RED) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Connect to server if needed
|
// Connect to server if needed
|
||||||
node.status({fill:"grey",shape:"ring",text:"connecting"});
|
|
||||||
if(!node.serverConfig.connected) {
|
if(!node.serverConfig.connected) {
|
||||||
|
node.status({fill:"grey",shape:"ring",text:"connecting"});
|
||||||
node.client.connect(function(sessionId) {}, function(error) {
|
node.client.connect(function(sessionId) {}, function(error) {
|
||||||
node.status({fill:"grey",shape:"dot",text:"error"});
|
node.status({fill:"grey",shape:"dot",text:"error"});
|
||||||
node.warn(error);
|
node.warn(error);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user