From 3fb75381491d1a1cebbd0f1d18b1c3e43989ae96 Mon Sep 17 00:00:00 2001 From: Alif Naufal Ilyas Date: Wed, 25 Feb 2026 03:59:43 +0700 Subject: [PATCH] Fix: change sessionId to get the last path instead of path number 3 or 2 (#111) --- src/websocket.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/websocket.js b/src/websocket.js index 019bf31..175bf4f 100644 --- a/src/websocket.js +++ b/src/websocket.js @@ -60,7 +60,7 @@ const handleUpgrade = (request, socket, head) => { const wsPath = basePath ? `${basePath}/ws/` : '/ws/' if (pathname.startsWith(wsPath)) { const pathParts = pathname.split('/') - const sessionId = basePath ? pathParts[3] : pathParts[2] + const sessionId = pathParts[pathParts.length - 1] const server = wssMap.get(sessionId) if (server) { server.handleUpgrade(request, socket, head, (ws) => {