docs
Some checks failed
Publish JS SDK / docker (push) Failing after 12s

This commit is contained in:
Braydon 2024-09-09 21:27:42 -04:00
parent 7687b66ad4
commit 67b849e574

@ -4,13 +4,22 @@ import { TetherConfig } from "@/types/config";
import { DiscordUser } from "@/types/user";
import { UserStatusPacket } from "@/types/socket";
/**
* Connect to the WebSocket and listen
* for status updates for the user with
* the given snowflake.
*
* @param snowflake the user's snowflake
* @param config the Tether config
*/
export const useTetherWS = (
snowflake: Snowflake,
{ endpoint, secure }: TetherConfig = {
config: TetherConfig = {
endpoint: "usetether.rest",
secure: true,
}
): DiscordUser | undefined => {
const { endpoint, secure } = config;
const url: string = `ws${secure && "s"}://${endpoint}/gateway`;
const [user, setUser] = useState<DiscordUser | undefined>();