diff --git a/src/transports/ws.js b/src/transports/ws.js index c829e76..b2b9e60 100644 --- a/src/transports/ws.js +++ b/src/transports/ws.js @@ -3,12 +3,18 @@ import { parse } from "node:querystring"; const portRange = [6463, 6472]; const checkIfOpen = async (port) => { - try { - await fetch(`http://localhost:${port}`); - return true; - } catch (e) { - return false; - } + new Promise((resolve) => { + const ws = new WebSocket(`ws://localhost:${port}`); + + ws.onopen = () => { + ws.close(); + resolve(true); + } + + ws.onerror = () => { + resolve(false); + } + }) }; const getPort = async () => {