diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-15 14:40:59 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-15 14:40:59 +0200 |
commit | f481a34b7bac425120574cc05d4f21789b46a741 (patch) | |
tree | 45fb603d7b8c6776b554ea3f83160ef98f4047ff /gateway/src | |
parent | Merge branch 'master' of https://github.com/fosscord/fosscord-server (diff) | |
download | server-f481a34b7bac425120574cc05d4f21789b46a741.tar.xz |
:bug: fix types
Diffstat (limited to '')
-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 |
3 files changed, 5 insertions, 1 deletions
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; |