From 4f12d6d3532027ab9fa5891f350bd89629f8fe7a Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Sun, 15 Aug 2021 14:40:59 +0200 Subject: :bug: fix types --- gateway/src/events/Close.ts | 1 + gateway/src/events/Connection.ts | 2 ++ gateway/src/events/Message.ts | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'gateway') 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; -- cgit 1.4.1