mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 21:58:48 +02:00
Remove redundant code
This commit is contained in:
parent
9b8c5326df
commit
530fb44de2
1 changed files with 0 additions and 8 deletions
|
@ -8,12 +8,10 @@ const crypto = require('crypto');
|
||||||
class WebSocketServer {
|
class WebSocketServer {
|
||||||
constructor({
|
constructor({
|
||||||
port = 0,
|
port = 0,
|
||||||
responseError = false,
|
|
||||||
}) {
|
}) {
|
||||||
this.port = port;
|
this.port = port;
|
||||||
this.server = http.createServer();
|
this.server = http.createServer();
|
||||||
this.clients = new Set();
|
this.clients = new Set();
|
||||||
this.responseError = responseError;
|
|
||||||
|
|
||||||
this.server.on('upgrade', this.handleUpgrade.bind(this));
|
this.server.on('upgrade', this.handleUpgrade.bind(this));
|
||||||
}
|
}
|
||||||
|
@ -51,12 +49,6 @@ class WebSocketServer {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.responseError) {
|
|
||||||
socket.write(Buffer.from([0x88, 0x00])); // close frame
|
|
||||||
socket.end();
|
|
||||||
this.clients.delete(socket);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
socket.write(this.encodeMessage('Hello from server!'));
|
socket.write(this.encodeMessage('Hello from server!'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue