restore ws functionality to webserver
This commit is contained in:
parent
091c535f80
commit
4b81968482
|
@ -343,7 +343,7 @@ Blockchain.prototype.initChainAndGetAddress = function(callback) {
|
|||
};
|
||||
|
||||
var BlockchainClient = function(blockchainConfig, client, env, onReadyCallback, onExitCallback) {
|
||||
const isDev = !!blockchainConfig.isDev;
|
||||
const isDev = Boolean(blockchainConfig.isDev);
|
||||
// TODO add other clients at some point
|
||||
if (client === 'geth') {
|
||||
return new Blockchain({blockchainConfig, client: GethCommands, env, isDev, onReadyCallback, onExitCallback});
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
const async = require('async');
|
||||
let serveStatic = require('serve-static');
|
||||
const {canonicalHost, defaultHost, dockerHostSwap} = require('../../utils/host');
|
||||
const expressWebSocket = require('express-ws');
|
||||
const express = require('express');
|
||||
const fs = require('../../core/fs');
|
||||
require('http-shutdown').extend();
|
||||
const webSocket = require('ws');
|
||||
|
||||
class Server {
|
||||
constructor(options) {
|
||||
|
@ -18,6 +18,7 @@ class Server {
|
|||
}
|
||||
|
||||
start(callback) {
|
||||
const self = this;
|
||||
if (this.server && this.server.listening) {
|
||||
let message = __("a webserver is already running at") + " " +
|
||||
("http://" + canonicalHost(this.hostname) +
|
||||
|
@ -33,17 +34,14 @@ class Server {
|
|||
this.app.use(main);
|
||||
this.app.use('/coverage', coverage);
|
||||
this.app.use(coverageStyle);
|
||||
|
||||
//this.wss = new webSocket.Server({server: this.server});
|
||||
//this.events.on('outputDone', () => {
|
||||
// this.wss.clients.forEach((ws) => {
|
||||
// if (ws.readyState === webSocket.OPEN) {
|
||||
// ws.send('outputDone');
|
||||
// }
|
||||
// });
|
||||
//});
|
||||
|
||||
const self = this;
|
||||
expressWebSocket(this.app);
|
||||
|
||||
this.app.ws('/', function(ws, _req) {
|
||||
self.events.on('outputDone', () => {
|
||||
ws.send('outputDone');
|
||||
});
|
||||
});
|
||||
|
||||
async.waterfall([
|
||||
function createPlaceholderPage(next) {
|
||||
|
|
|
@ -3489,6 +3489,24 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"express-ws": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/express-ws/-/express-ws-4.0.0.tgz",
|
||||
"integrity": "sha512-KEyUw8AwRET2iFjFsI1EJQrJ/fHeGiJtgpYgEWG3yDv4l/To/m3a2GaYfeGyB3lsWdvbesjF5XCMx+SVBgAAYw==",
|
||||
"requires": {
|
||||
"ws": "^5.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"ws": {
|
||||
"version": "5.2.2",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz",
|
||||
"integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==",
|
||||
"requires": {
|
||||
"async-limiter": "~1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"extend": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
|
||||
|
@ -11076,14 +11094,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"ws": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-6.0.0.tgz",
|
||||
"integrity": "sha512-c2UlYcAZp1VS8AORtpq6y4RJIkJ9dQz18W32SpR/qXGfLDZ2jU4y4wKvvZwqbi7U6gxFQTeE+urMbXU/tsDy4w==",
|
||||
"requires": {
|
||||
"async-limiter": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"xhr": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz",
|
||||
|
|
28
package.json
28
package.json
|
@ -46,20 +46,20 @@
|
|||
"eth-ens-namehash": "2.0.8",
|
||||
"eth-lib": "0.2.8",
|
||||
"ethereumjs-wallet": "0.6.0",
|
||||
"express": "4.16.3",
|
||||
"file-loader": "1.1.11",
|
||||
"finalhandler": "1.1.1",
|
||||
"flatted": "0.2.3",
|
||||
"follow-redirects": "1.5.7",
|
||||
"fs-extra": "2.1.2",
|
||||
"ganache-cli": "6.1.8",
|
||||
"glob": "7.1.3",
|
||||
"globule": "1.2.1",
|
||||
"hard-source-webpack-plugin": "0.11.2",
|
||||
"hosted-git-info": "2.7.1",
|
||||
"http-proxy": "1.17.0",
|
||||
"http-shutdown": "1.2.0",
|
||||
"i18n": "0.8.3",
|
||||
"express": "^4.16.3",
|
||||
"express-ws": "^4.0.0",
|
||||
"file-loader": "^1.1.5",
|
||||
"finalhandler": "^1.1.1",
|
||||
"flatted": "^0.2.3",
|
||||
"follow-redirects": "^1.2.4",
|
||||
"fs-extra": "^2.0.0",
|
||||
"ganache-cli": "^6.1.6",
|
||||
"glob": "^7.1.2",
|
||||
"globule": "^1.1.0",
|
||||
"hard-source-webpack-plugin": "^0.11.1",
|
||||
"http-proxy": "^1.17.0",
|
||||
"http-shutdown": "^1.2.0",
|
||||
"i18n": "^0.8.3",
|
||||
"ipfs-api": "17.2.4",
|
||||
"is-valid-domain": "0.0.5",
|
||||
"istanbul": "0.4.5",
|
||||
|
|
Loading…
Reference in New Issue