fix react error?
All checks were successful
Publish JS SDK / docker (push) Successful in 13s

This commit is contained in:
Braydon 2024-09-09 19:55:07 -04:00
parent b78cd9ba8a
commit 2b5e14b734
2 changed files with 4 additions and 3 deletions

@ -1,6 +1,6 @@
{
"name": "usetether",
"version": "1.0.5",
"version": "1.0.6",
"author": "Braydon (Rainnny) <braydonrainnny@gmail.com>",
"description": "An API designed to provide real-time access to a user's Discord data.",
"keywords": [

@ -12,6 +12,7 @@ export const useTetherWS = (
): DiscordUser | undefined => {
const [user] = useState<DiscordUser | undefined>();
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;
};