Fix: change sessionId to get the last path instead of path number 3 or 2 (#111)
This commit is contained in:
parent
73db3b322b
commit
3fb7538149
1 changed files with 1 additions and 1 deletions
|
|
@ -60,7 +60,7 @@ const handleUpgrade = (request, socket, head) => {
|
||||||
const wsPath = basePath ? `${basePath}/ws/` : '/ws/'
|
const wsPath = basePath ? `${basePath}/ws/` : '/ws/'
|
||||||
if (pathname.startsWith(wsPath)) {
|
if (pathname.startsWith(wsPath)) {
|
||||||
const pathParts = pathname.split('/')
|
const pathParts = pathname.split('/')
|
||||||
const sessionId = basePath ? pathParts[3] : pathParts[2]
|
const sessionId = pathParts[pathParts.length - 1]
|
||||||
const server = wssMap.get(sessionId)
|
const server = wssMap.get(sessionId)
|
||||||
if (server) {
|
if (server) {
|
||||||
server.handleUpgrade(request, socket, head, (ws) => {
|
server.handleUpgrade(request, socket, head, (ws) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue