test
Some checks failed
Publish JS SDK / docker (push) Has been cancelled

This commit is contained in:
Braydon 2024-09-09 20:19:35 -04:00
parent ce31226448
commit 455d83543b

@ -11,37 +11,9 @@ export const useTetherWS = (
): Snowflake => {
const [user] = useState<Snowflake>(snowflake);
const url: string = `ws${secure && "s"}://${endpoint}/gateway`;
useEffect(() => {
// Prevent from running on the server
if (typeof window === "undefined") {
return;
}
let socket: WebSocket; // The current WebSocket connection
/**
* Establish a connection with the API.
*/
function connect() {
console.log("connecting to:", url);
socket = new WebSocket("wss://usetether.rest/gateway"); // Connect to the gateway
socket.addEventListener("open", () =>
console.log("[Tether] WebSocket connection established!")
);
// socket.addEventListener("close", connect);
//
// socket.addEventListener("message", (event) => {
// console.log("data:", event.data);
// });
}
connect();
// Cleanup
return () => {
// socket.removeEventListener("close", connect);
socket.close();
};
}, [url]);
console.log("HELLO WORLD");
}, [snowflake]);
return user;
};