Skip to content

Commit

Permalink
4.0.2: Avoid process crash in Node 10 due to unhandled "error" event …
Browse files Browse the repository at this point in the history
…in socket (related to theturtle32/WebSocket-Node#351)
  • Loading branch information
ibc committed Mar 7, 2019
1 parent 5b56768 commit 105e36b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "protoo-client",
"version": "4.0.1",
"version": "4.0.2",
"description": "protoo JavaScript client module",
"author": "Iñaki Baz Castillo <[email protected]>",
"homepage": "https://protoojs.org",
Expand All @@ -27,7 +27,7 @@
"retry": "^0.12.0"
},
"devDependencies": {
"eslint": "^5.13.0"
"eslint": "^5.15.1"
},
"optionalDependencies": {
"websocket": "^1.0.28"
Expand Down
6 changes: 4 additions & 2 deletions server/lib/transports/WebSocketServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ class WebSocketServer extends EnhancedEventEmitter
logger.debug(
'onRequest() [origin:%s | path:"%s"]', request.origin, request.resource);

// NOTE: To avoid https://github.com/theturtle32/WebSocket-Node/issues/351
// in Node 10.
request.httpRequest.socket.on('error', () => {});

// Validate WebSocket sub-protocol.
if (request.requestedProtocols.indexOf(WS_SUBPROTOCOL) === -1)
{
Expand Down Expand Up @@ -146,8 +150,6 @@ class WebSocketServer extends EnhancedEventEmitter
}
catch (error)
{
logger.error('_onRequest() | unexpected error:%o', error);

request.reject(500, String(error));
}
}
Expand Down
4 changes: 2 additions & 2 deletions server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "protoo-server",
"version": "4.0.1",
"version": "4.0.2",
"description": "protoo Node.js server module",
"author": "Iñaki Baz Castillo <[email protected]>",
"homepage": "https://protoojs.org",
Expand All @@ -25,6 +25,6 @@
"websocket": "^1.0.28"
},
"devDependencies": {
"eslint": "^5.13.0"
"eslint": "^5.15.1"
}
}
8 changes: 4 additions & 4 deletions test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"rootDir": "../"
},
"devDependencies": {
"eslint": "^5.13.0",
"eslint-plugin-jest": "^22.2.2",
"jest": "^24.0.0",
"jest-tobetype": "^1.2.0",
"eslint": "^5.15.1",
"eslint-plugin-jest": "^22.3.0",
"jest": "^24.1.0",
"jest-tobetype": "^1.2.2",
"opn-cli": "^4.0.0"
}
}

0 comments on commit 105e36b

Please sign in to comment.