Bugfix shared connection

This commit is contained in:
Olivier Verhaegen 2023-04-12 13:50:39 +02:00 committed by GitHub
parent b91aa6a506
commit 0c52d6b8be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,10 +59,10 @@ module.exports = function(RED) {
var node = this; var node = this;
var msg = {topic:this.topic}; var msg = {topic:this.topic};
// Save the client connection to the shared server instance if needed // Save the client connection to the shared server instance if needed
if (!node.server.clientConnection) { if (!node.serverConfig.clientConnection) {
node.server.clientConnection = new StompClient(node.stompClientOpts); node.serverConfig.clientConnection = new StompClient(node.stompClientOpts);
} }
node.client = node.server.clientConnection; node.client = node.serverConfig.clientConnection;
node.client.on("connect", function() { node.client.on("connect", function() {
node.status({fill:"green",shape:"dot",text:"connected"}); node.status({fill:"green",shape:"dot",text:"connected"});
@ -134,10 +134,10 @@ module.exports = function(RED) {
var node = this; var node = this;
// Save the client connection to the shared server instance if needed // Save the client connection to the shared server instance if needed
if (!node.server.clientConnection) { if (!node.serverConfig.clientConnection) {
node.server.clientConnection = new StompClient(node.stompClientOpts); node.serverConfig.clientConnection = new StompClient(node.stompClientOpts);
} }
node.client = node.server.clientConnection; node.client = node.serverConfig.clientConnection;
node.client.on("connect", function() { node.client.on("connect", function() {
node.status({fill:"green",shape:"dot",text:"connected"}); node.status({fill:"green",shape:"dot",text:"connected"});
@ -203,10 +203,10 @@ module.exports = function(RED) {
// only start connection etc. when acknowledgements are configured to be send by client // only start connection etc. when acknowledgements are configured to be send by client
if (node.serverConfig.ack) { if (node.serverConfig.ack) {
// Save the client connection to the shared server instance if needed // Save the client connection to the shared server instance if needed
if (!node.server.clientConnection) { if (!node.serverConfig.clientConnection) {
node.server.clientConnection = new StompClient(node.stompClientOpts); node.serverConfig.clientConnection = new StompClient(node.stompClientOpts);
} }
node.client = node.server.clientConnection; node.client = node.serverConfig.clientConnection;
node.client.on("connect", function() { node.client.on("connect", function() {
node.status({fill:"green",shape:"dot",text:"connected"}); node.status({fill:"green",shape:"dot",text:"connected"});