From cef72736cc0172b4bb9a3a822cdb2c1a5baf6ff4 Mon Sep 17 00:00:00 2001 From: Le Vivilet <72156503+levivilet@users.noreply.github.com> Date: Sun, 25 Aug 2024 10:54:47 +0200 Subject: [PATCH] feature: simplify code (#7) --- src/parts/WebSocketServer/WebSocketServer.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/parts/WebSocketServer/WebSocketServer.js b/src/parts/WebSocketServer/WebSocketServer.js index 85a68f0..cfe2c74 100644 --- a/src/parts/WebSocketServer/WebSocketServer.js +++ b/src/parts/WebSocketServer/WebSocketServer.js @@ -21,9 +21,6 @@ export const handleUpgrade = (request, socket) => { throw new TypeError(`socket must be of type Socket`) } const { promise, resolve } = Promises.withResolvers() - const upgradeCallback = (ws) => { - resolve(ws) - } - webSocketServer.handleUpgrade(request, socket, Buffer.alloc(0), upgradeCallback) + webSocketServer.handleUpgrade(request, socket, Buffer.alloc(0), resolve) return promise }