mirror of
https://github.com/ragestudio/comty.js.git
synced 2025-06-09 10:34:19 +00:00
Fix ping measurement to use first available socket
This commit is contained in:
parent
0face5f004
commit
511a81e313
@ -31,15 +31,18 @@ const fetchers = {
|
|||||||
resolve("failed")
|
resolve("failed")
|
||||||
}, 5000)
|
}, 5000)
|
||||||
|
|
||||||
globalThis.__comty_shared_state.ws.sockets
|
const sockets = globalThis.__comty_shared_state.ws.sockets
|
||||||
.get("main")
|
let firstSocket = sockets.keys().next().value
|
||||||
.once("pong", () => {
|
|
||||||
|
firstSocket = sockets.get(firstSocket)
|
||||||
|
|
||||||
|
firstSocket.once("pong", () => {
|
||||||
failTimeout && clearTimeout(failTimeout)
|
failTimeout && clearTimeout(failTimeout)
|
||||||
|
|
||||||
resolve(Date.now() - start)
|
resolve(Date.now() - start)
|
||||||
})
|
})
|
||||||
|
|
||||||
globalThis.__comty_shared_state.ws.sockets.get("main").emit("ping")
|
firstSocket.emit("ping")
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user