🐛 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 interface CDNServerOptions extends ServerOptions {}
export class CDNServer extends Server { export class CDNServer extends Server {
public options: CDNServerOptions; public declare options: CDNServerOptions;
constructor(options?: Partial<CDNServerOptions>) { constructor(options?: Partial<CDNServerOptions>) {
super(options); super(options);

View File

@ -2,5 +2,6 @@ import WebSocket from "ws";
import { Message } from "./Message"; import { Message } from "./Message";
export function Close(this: WebSocket, code: number, reason: string) { export function Close(this: WebSocket, code: number, reason: string) {
// @ts-ignore
this.off("message", Message); this.off("message", Message);
} }

View File

@ -6,6 +6,7 @@ import { setHeartbeat } from "../util/setHeartbeat";
import { Send } from "../util/Send"; import { Send } from "../util/Send";
import { CLOSECODES, OPCODES } from "../util/Constants"; import { CLOSECODES, OPCODES } from "../util/Constants";
import { createDeflate } from "zlib"; import { createDeflate } from "zlib";
import { URL } from "url";
var erlpack: any; var erlpack: any;
try { try {
erlpack = require("erlpack"); erlpack = require("erlpack");
@ -18,6 +19,7 @@ try {
export async function Connection(this: Server, socket: WebSocket, request: IncomingMessage) { export async function Connection(this: Server, socket: WebSocket, request: IncomingMessage) {
try { try {
socket.on("close", Close); socket.on("close", Close);
// @ts-ignore
socket.on("message", Message); socket.on("message", Message);
const { searchParams } = new URL(`http://localhost${request.url}`); 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 { Payload, CLOSECODES } from "../util/Constants";
import { instanceOf, Tuple } from "lambert-server"; import { instanceOf, Tuple } from "lambert-server";
import { check } from "../opcodes/instanceOf"; import { check } from "../opcodes/instanceOf";
import WS from "ws";
const PayloadSchema = { const PayloadSchema = {
op: Number, op: Number,
@ -15,7 +16,7 @@ const PayloadSchema = {
$t: String, $t: String,
}; };
export async function Message(this: WebSocket, buffer: Data) { export async function Message(this: WebSocket, buffer: WS.Data) {
// TODO: compression // TODO: compression
var data: Payload; var data: Payload;