diff --git a/JS-SDK/package.json b/JS-SDK/package.json index 8ff5368..3916a07 100644 --- a/JS-SDK/package.json +++ b/JS-SDK/package.json @@ -1,6 +1,6 @@ { "name": "usetether", - "version": "1.0.5", + "version": "1.0.6", "author": "Braydon (Rainnny) ", "description": "An API designed to provide real-time access to a user's Discord data.", "keywords": [ diff --git a/JS-SDK/src/lib/tether.ts b/JS-SDK/src/lib/tether.ts index 1cd5dad..cdb1410 100644 --- a/JS-SDK/src/lib/tether.ts +++ b/JS-SDK/src/lib/tether.ts @@ -12,6 +12,7 @@ export const useTetherWS = ( ): DiscordUser | undefined => { const [user] = useState(); + const url: string = `ws${secure && "s"}://${endpoint}/gateway`; useEffect(() => { let socket: WebSocket; // The current WebSocket connection @@ -19,7 +20,7 @@ export const useTetherWS = ( * Establish a connection with the API. */ function connect() { - socket = new WebSocket(`ws${secure && "s"}://${endpoint}/gateway`); // Connect to the gateway + socket = new WebSocket(url); // Connect to the gateway socket.addEventListener("open", () => console.log("[Tether] WebSocket connection established!") ); @@ -36,7 +37,7 @@ export const useTetherWS = ( socket.removeEventListener("close", connect); socket.close(); }; - }, [endpoint, secure]); + }, [url]); return user; };