This commit is contained in:
parent
0fe3426453
commit
ce31226448
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "usetether",
|
"name": "usetether",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"author": "Braydon (Rainnny) <braydonrainnny@gmail.com>",
|
"author": "Braydon (Rainnny) <braydonrainnny@gmail.com>",
|
||||||
"description": "An API designed to provide real-time access to a user's Discord data.",
|
"description": "An API designed to provide real-time access to a user's Discord data.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Snowflake } from "@/types/snowflake";
|
import { Snowflake } from "@/types/snowflake";
|
||||||
import { TetherConfig } from "@/types/config";
|
import { TetherConfig } from "@/types/config";
|
||||||
import { DiscordUser } from "@/types/user";
|
|
||||||
|
|
||||||
export const useTetherWS = (
|
export const useTetherWS = (
|
||||||
snowflake: Snowflake,
|
snowflake: Snowflake,
|
||||||
@ -9,8 +8,8 @@ export const useTetherWS = (
|
|||||||
endpoint: "usetether.rest",
|
endpoint: "usetether.rest",
|
||||||
secure: true,
|
secure: true,
|
||||||
}
|
}
|
||||||
): DiscordUser | undefined => {
|
): Snowflake => {
|
||||||
const [user] = useState<DiscordUser | undefined>();
|
const [user] = useState<Snowflake>(snowflake);
|
||||||
|
|
||||||
const url: string = `ws${secure && "s"}://${endpoint}/gateway`;
|
const url: string = `ws${secure && "s"}://${endpoint}/gateway`;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -24,6 +23,7 @@ export const useTetherWS = (
|
|||||||
* Establish a connection with the API.
|
* Establish a connection with the API.
|
||||||
*/
|
*/
|
||||||
function connect() {
|
function connect() {
|
||||||
|
console.log("connecting to:", url);
|
||||||
socket = new WebSocket("wss://usetether.rest/gateway"); // Connect to the gateway
|
socket = new WebSocket("wss://usetether.rest/gateway"); // Connect to the gateway
|
||||||
socket.addEventListener("open", () =>
|
socket.addEventListener("open", () =>
|
||||||
console.log("[Tether] WebSocket connection established!")
|
console.log("[Tether] WebSocket connection established!")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user