async setupProxy

This commit is contained in:
Michael Bradley, Jr 2018-09-19 20:10:46 -05:00
parent b9975668b8
commit 35c772d727
1 changed files with 7 additions and 3 deletions

View File

@ -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() {