summary refs log tree commit diff
path: root/gateway/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'gateway/src/util')
-rw-r--r--gateway/src/util/Send.ts8
-rw-r--r--gateway/src/util/WebSocket.ts7
-rw-r--r--gateway/src/util/index.ts5
-rw-r--r--gateway/src/util/setHeartbeat.ts2
4 files changed, 11 insertions, 11 deletions
diff --git a/gateway/src/util/Send.ts b/gateway/src/util/Send.ts

index be25ac4f..4defa898 100644 --- a/gateway/src/util/Send.ts +++ b/gateway/src/util/Send.ts
@@ -1,10 +1,8 @@ var erlpack: any; try { - erlpack = require("erlpack"); + erlpack = require("@yukikaze-bot/erlpack"); } catch (error) {} -import { Payload } from "../util/Constants"; - -import WebSocket from "./WebSocket"; +import { Payload, WebSocket } from "@fosscord/gateway"; export async function Send(socket: WebSocket, data: Payload) { let buffer: Buffer | string; @@ -20,7 +18,7 @@ export async function Send(socket: WebSocket, data: Payload) { } return new Promise((res, rej) => { - socket.send(buffer, (err) => { + socket.send(buffer, (err: any) => { if (err) return rej(err); return res(null); }); diff --git a/gateway/src/util/WebSocket.ts b/gateway/src/util/WebSocket.ts
index 2c763743..b80265a7 100644 --- a/gateway/src/util/WebSocket.ts +++ b/gateway/src/util/WebSocket.ts
@@ -1,9 +1,9 @@ import { Intents, Permissions } from "@fosscord/util"; -import WS, { Server, Data } from "ws"; +import WS from "ws"; import { Deflate } from "zlib"; import { Channel } from "amqplib"; -interface WebSocket extends WS { +export interface WebSocket extends WS { version: number; user_id: string; session_id: string; @@ -19,6 +19,3 @@ interface WebSocket extends WS { permissions: Record<string, Permissions>; events: Record<string, Function>; } - -export default WebSocket; -export { Server, Data }; diff --git a/gateway/src/util/index.ts b/gateway/src/util/index.ts new file mode 100644
index 00000000..27af5813 --- /dev/null +++ b/gateway/src/util/index.ts
@@ -0,0 +1,5 @@ +export * from "./Constants"; +export * from "./Send"; +export * from "./SessionUtils"; +export * from "./setHeartbeat"; +export * from "./WebSocket"; diff --git a/gateway/src/util/setHeartbeat.ts b/gateway/src/util/setHeartbeat.ts
index 9f88b481..f6871cfe 100644 --- a/gateway/src/util/setHeartbeat.ts +++ b/gateway/src/util/setHeartbeat.ts
@@ -1,5 +1,5 @@ import { CLOSECODES } from "./Constants"; -import WebSocket from "./WebSocket"; +import { WebSocket } from "./WebSocket"; // TODO: make heartbeat timeout configurable export function setHeartbeat(socket: WebSocket) {