Skip to content

Commit

Permalink
close hmr server when HMRServer.stop() is called (#1079)
Browse files Browse the repository at this point in the history
  • Loading branch information
ronami authored and devongovett committed Mar 28, 2018
1 parent 8a95f70 commit 4bd32f2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/HMRServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@ const logger = require('./Logger');
class HMRServer {
async start(options = {}) {
await new Promise(async resolve => {
let server;
if (!options.https) {
server = http.createServer();
this.server = http.createServer();
} else if (typeof options.https === 'boolean') {
server = https.createServer(generateCertificate(options));
this.server = https.createServer(generateCertificate(options));
} else {
server = https.createServer(await getCertificate(options.https));
this.server = https.createServer(await getCertificate(options.https));
}

this.wss = new WebSocket.Server({server});
server.listen(options.hmrPort, resolve);
this.wss = new WebSocket.Server({server: this.server});
this.server.listen(options.hmrPort, resolve);
});

this.wss.on('connection', ws => {
Expand All @@ -36,6 +35,7 @@ class HMRServer {

stop() {
this.wss.close();
this.server.close();
}

emitError(err) {
Expand Down

0 comments on commit 4bd32f2

Please sign in to comment.