From 35c772d727a8288cd688c332d74eaabd5cdba9cf Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Wed, 19 Sep 2018 20:10:46 -0500 Subject: [PATCH] async setupProxy --- lib/modules/blockchain_process/blockchain.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/modules/blockchain_process/blockchain.js b/lib/modules/blockchain_process/blockchain.js index 90e4a161..4cb42eaa 100644 --- a/lib/modules/blockchain_process/blockchain.js +++ b/lib/modules/blockchain_process/blockchain.js @@ -93,13 +93,17 @@ Blockchain.prototype.initProxy = function() { this.config.wsPort += constants.blockchain.servicePortOnProxy; }; -Blockchain.prototype.setupProxy = function() { +Blockchain.prototype.setupProxy = async function() { const proxy = require('./proxy'); const Ipc = require('../../core/ipc'); let ipcObject = new Ipc({ipcRole: 'client'}); - this.rpcProxy = proxy.serve(ipcObject, this.config.rpcHost, this.config.rpcPort, false); - this.wsProxy = proxy.serve(ipcObject, this.config.wsHost, this.config.wsPort, true); + const [rpcProxy, wsProxy] = await Promise.all([ + proxy.serve(ipcObject, this.config.rpcHost, this.config.rpcPort, false), + proxy.serve(ipcObject, this.config.wsHost, this.config.wsPort, true, this.config.wsOrigins) + ]); + this.rpcProxy = rpcProxy; + this.wsProxy = wsProxy; }; Blockchain.prototype.shutdownProxy = function() {