diff --git a/src/index.js b/src/index.js index 51acfb9..d0cc37c 100644 --- a/src/index.js +++ b/src/index.js @@ -15,9 +15,9 @@ async function run() { const node = await libp2pManager.createNode(); const messageHandler = new MessageHandler(libp2pManager, logger); const wsManager = new WebSocketManager(messageHandler, logger, node); - const relayAddr = multiaddr(libp2pManager.realayAddress) - const feedbackManager = new FeedbackManager(logger, wsManager, messageHandler) - libp2pManager.setFeedbackManager(feedbackManager) + const relayAddr = multiaddr(libp2pManager.realayAddress); + const feedbackManager = new FeedbackManager(logger, wsManager, messageHandler); + libp2pManager.setFeedbackManager(feedbackManager); wsManager.onConnectionManager(); logger.INFO(`Node started with id ${node.peerId.toString()}`); diff --git a/src/libp2pManager.js b/src/libp2pManager.js index 0fd9890..020ef22 100644 --- a/src/libp2pManager.js +++ b/src/libp2pManager.js @@ -20,11 +20,11 @@ export class Libp2pManager { this.configuration = new ConfigurationManager(logger); this.realayAddress = '/dns4/libp2p-relay-1.robonomics.network/tcp/443/wss/p2p/12D3KooWEMFXXvpZUjAuj1eKR11HuzZTCQ5HmYG9MNPtsnqPSERD'; this.logger = logger; - this.feedbackManager = undefined + this.feedbackManager = undefined; } setFeedbackManager(feedbackManager) { - this.feedbackManager = feedbackManager + this.feedbackManager = feedbackManager; } /** @@ -186,14 +186,14 @@ export class Libp2pManager { const response = await this.#request(connection, protocol, data); this.logger.INFO(`Sending message to ${connection.remoteAddr.toString()}`); this.logger.INFO(response, ' got response from sendMsg'); - if (!(typeof ws === "undefined")) { - this.feedbackManager.sendFeedbackMessage(response, ws) + if (!(typeof ws === 'undefined')) { + this.feedbackManager.sendFeedbackMessage('ok', ws); } } } catch (error) { this.logger.ERROR(error.message, 'sendMsg'); if (ws) { - this.feedbackManager.sendFeedbackMessage(error.message, ws) + this.feedbackManager.sendFeedbackMessage(error.message, ws); } } } diff --git a/src/messageHandler.js b/src/messageHandler.js index 301526e..0787fb0 100644 --- a/src/messageHandler.js +++ b/src/messageHandler.js @@ -127,7 +127,7 @@ export class MessageHandler { this.libp2pManager.sendMsg(connection, msg.data, protocol); } else { this.libp2pManager.connect2NodeViaRelay(node, serverPeerId).then((connection) => { - this.libp2pManager.sendMsg(connection, msg.data, protocol, ws) + this.libp2pManager.sendMsg(connection, msg.data, protocol, ws); }).catch((error) => { this.logger.ERROR(error, "onWSMessage couldn't resolve promise"); }); } } else { @@ -136,4 +136,4 @@ export class MessageHandler { }); } } -} \ No newline at end of file +}