diff options
-rw-r--r-- | cdn/src/Server.ts | 2 | ||||
-rw-r--r-- | gateway/src/events/Close.ts | 1 | ||||
-rw-r--r-- | gateway/src/events/Connection.ts | 2 | ||||
-rw-r--r-- | gateway/src/events/Message.ts | 3 |
4 files changed, 6 insertions, 2 deletions
diff --git a/cdn/src/Server.ts b/cdn/src/Server.ts index a73a948c..522e11c2 100644 --- a/cdn/src/Server.ts +++ b/cdn/src/Server.ts @@ -6,7 +6,7 @@ import avatarsRoute from "./routes/avatars"; export interface CDNServerOptions extends ServerOptions {} export class CDNServer extends Server { - public options: CDNServerOptions; + public declare options: CDNServerOptions; constructor(options?: Partial<CDNServerOptions>) { super(options); diff --git a/gateway/src/events/Close.ts b/gateway/src/events/Close.ts index f819b064..f1a8fa9b 100644 --- a/gateway/src/events/Close.ts +++ b/gateway/src/events/Close.ts @@ -2,5 +2,6 @@ import WebSocket from "ws"; import { Message } from "./Message"; export function Close(this: WebSocket, code: number, reason: string) { + // @ts-ignore this.off("message", Message); } diff --git a/gateway/src/events/Connection.ts b/gateway/src/events/Connection.ts index 5fbcbff5..fed3c611 100644 --- a/gateway/src/events/Connection.ts +++ b/gateway/src/events/Connection.ts @@ -6,6 +6,7 @@ import { setHeartbeat } from "../util/setHeartbeat"; import { Send } from "../util/Send"; import { CLOSECODES, OPCODES } from "../util/Constants"; import { createDeflate } from "zlib"; +import { URL } from "url"; var erlpack: any; try { erlpack = require("erlpack"); @@ -18,6 +19,7 @@ try { export async function Connection(this: Server, socket: WebSocket, request: IncomingMessage) { try { socket.on("close", Close); + // @ts-ignore socket.on("message", Message); const { searchParams } = new URL(`http://localhost${request.url}`); diff --git a/gateway/src/events/Message.ts b/gateway/src/events/Message.ts index 2ca82b3c..0a3979c4 100644 --- a/gateway/src/events/Message.ts +++ b/gateway/src/events/Message.ts @@ -7,6 +7,7 @@ import OPCodeHandlers from "../opcodes"; import { Payload, CLOSECODES } from "../util/Constants"; import { instanceOf, Tuple } from "lambert-server"; import { check } from "../opcodes/instanceOf"; +import WS from "ws"; const PayloadSchema = { op: Number, @@ -15,7 +16,7 @@ const PayloadSchema = { $t: String, }; -export async function Message(this: WebSocket, buffer: Data) { +export async function Message(this: WebSocket, buffer: WS.Data) { // TODO: compression var data: Payload; |