Skip to content

Commit 9a1edc1

Browse files
chore: update ws (#3524)
1 parent a6501e6 commit 9a1edc1

File tree

5 files changed

+564
-889
lines changed

5 files changed

+564
-889
lines changed

lib/servers/WebsocketServer.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,19 @@ module.exports = class WebsocketServer extends BaseServer {
1212
constructor(server) {
1313
super(server);
1414

15-
this.implementation = new WebSocket.Server({
15+
const options = {
1616
...this.server.options.webSocketServer.options,
1717
clientTracking: false,
18-
noServer: true,
19-
});
18+
};
19+
const isNoServerMode =
20+
typeof options.port === 'undefined' &&
21+
typeof options.server === 'undefined';
22+
23+
if (isNoServerMode) {
24+
options.noServer = true;
25+
}
26+
27+
this.implementation = new WebSocket.Server(options);
2028

2129
this.server.server.on('upgrade', (req, sock, head) => {
2230
if (!this.implementation.shouldHandle(req)) {

0 commit comments

Comments
 (0)