Skip to content

Commit

Permalink
Ignore network errors like ECONNRESET, EPIPE - fixes #106
Browse files Browse the repository at this point in the history
  • Loading branch information
klaasman committed Mar 16, 2018
1 parent 89ed308 commit 49ce8ef
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion library/webpack-plugins/websocket-communication-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,14 @@ function findFreePort(retries = 2) {
}

function startWebSocketServer(port) {
console.log(`WebSocket opened on port ${port}`)
const wss = new ws.Server({ port })
wss.on('connection', ws => {
ws.on('error', err => {
// Ignore network errors like `ECONNRESET`, `EPIPE`, etc., fixes https://github.com/kaliberjs/build/issues/106
if (err.errno) return
throw err
})
})

return {
send: message => {
Expand Down

0 comments on commit 49ce8ef

Please sign in to comment.