🐛 fix types

This commit is contained in:
Flam3rboy 2021-08-15 14:40:59 +02:00
parent 3a64bfe0cb
commit f481a34b7b
4 changed files with 6 additions and 2 deletions

View File

@ -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);

View File

@ -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);
}

View File

@ -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}`);

View File

@ -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;