Session id on connect fix

This commit is contained in:
Olivier Verhaegen 2023-06-09 11:44:31 +02:00 committed by GitHub
parent 85579b1af8
commit d0245ee7ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -184,10 +184,11 @@ module.exports = function(RED) {
node.client = new StompClient(node.options);
node.client.on("connect", function() {
node.client.on("connect", function(sessionId) {
node.closing = false;
node.connecting = false;
node.connected = true;
node.sessionId = sessionId;
node.log(`Connected to STOMP server, sessionId: ${node.sessionId}, url: ${node.options.address}:${node.options.port}, protocolVersion: ${node.options.protocolVersion}`);
setStatusConnected(node, true);
@ -219,10 +220,7 @@ module.exports = function(RED) {
setStatusError(node, true);
});
node.client.connect(function(sessionId) {
node.sessionId = sessionId;
});
node.client.connect();
} catch (err) {
node.error(err);
}
@ -322,7 +320,7 @@ module.exports = function(RED) {
delete node.subscriptionIds[queue];
if (node.connected && !node.closing) {
node.client.unsubscribe(queue, headers);
node.log(`Unsubscribed from ${queue}, headers: ${headers}`);
node.log(`Unsubscribed from ${queue}, headers: ${JSON.stringify(headers)}`);
}
}