diff --git a/src/lib/modules/blockchain_process/simulator.js b/src/lib/modules/blockchain_process/simulator.js index bb7c64b4f..64a8afc29 100644 --- a/src/lib/modules/blockchain_process/simulator.js +++ b/src/lib/modules/blockchain_process/simulator.js @@ -86,6 +86,10 @@ class Simulator { if(useProxy){ let ipcObject = new Ipc({ipcRole: 'client'}); + if (this.blockchainConfig.wsRPC) { + return new Proxy(ipcObject).serve(host, port, true, this.blockchainConfig.wsOrigins, []); + } + new Proxy(ipcObject).serve(host, port, false); } } diff --git a/src/lib/utils/utils.js b/src/lib/utils/utils.js index d1138afa0..4d32d39d8 100644 --- a/src/lib/utils/utils.js +++ b/src/lib/utils/utils.js @@ -127,7 +127,9 @@ function pingEndpoint(host, port, type, protocol, origin, callback) { }; const handleSuccess = (req, closeMethod, event) => { - req.once(event, () => { handleEvent(req, closeMethod); }); + req.once(event, () => { + handleEvent(req, closeMethod); + }); }; const handleRequest = (req, closeMethod, event) => { @@ -136,10 +138,8 @@ function pingEndpoint(host, port, type, protocol, origin, callback) { }; if (type === 'ws') { - const req = new (require('ws'))( - `${protocol === 'https' ? 'wss' : 'ws'}://${_host}:${port}/`, - origin ? {origin} : {} - ); + const url = `${protocol === 'https' ? 'wss' : 'ws'}://${_host}:${port}/`; + const req = new (require('ws'))(url, origin ? {origin} : {}); handleRequest(req, 'close', 'open'); } else { const headers = origin ? {Origin: origin} : {};