From 4fcb377ace07c8aa668a65d12a9a70b4df511dd7 Mon Sep 17 00:00:00 2001 From: dajanaGJ Date: Wed, 3 Jul 2024 10:23:12 +0200 Subject: [PATCH] Send message to frameId instead slaveId --- src/master_gateway.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/master_gateway.js b/src/master_gateway.js index b4808b0..64630ed 100644 --- a/src/master_gateway.js +++ b/src/master_gateway.js @@ -171,7 +171,8 @@ var masterGateway = { // Check if there is existing subscription on event(action + uuid) if (self.isSubscribed(event.data.action)) { resolveOrReject = function(flag, returnData){ - self.sendMessage(slaveId, { + + self.sendMessage(self.slaves[slaveId].frameId, { data: returnData || { ack: true }, promiseResult: flag, action: event.data.action + '_' + event.data.uuid, @@ -360,10 +361,10 @@ var masterGateway = { clearTimeout(rejectTimeout); rejectTimeout = null; if (response.promiseResult === 'resolve') { - logger.out('info', '[GG] Slave.' + self.slaveId + 'Promise resolved for event ' + event); + logger.out('info', '[GG] Slave.' + self.slaveId + ' Promise resolved for event ' + event); resolve(response.data); } else { - logger.out('info', '[GG] Slave.' + self.slaveId + 'Promise rejected for event ' + event); + logger.out('info', '[GG] Slave.' + self.slaveId + ' Promise rejected for event ' + event); reject(response.data); } @@ -373,7 +374,7 @@ var masterGateway = { rejectTimeout = setTimeout(function() { subscription.remove(); reject(); - logger.out('info', '[GG] Slave.' + self.slaveId + 'Promise rejected after timeout for event ' + event); + logger.out('info', '[GG] Slave.' + self.slaveId + ' Promise rejected after timeout for event ' + event); }, rejectDuration); }