change ws import

This commit is contained in:
Sainan 2025-09-08 05:09:39 +02:00
parent 6df625e838
commit a0f7d3b793

View File

@ -1,6 +1,6 @@
import type http from "http"; import type http from "http";
import type https from "https"; import type https from "https";
import type { default as ws } from "ws"; import type { WebSocket } from "ws";
import { WebSocketServer } from "ws"; import { WebSocketServer } from "ws";
import { Account } from "../models/loginModel.ts"; import { Account } from "../models/loginModel.ts";
import { createAccount, createNonce, getUsernameFromEmail, isCorrectPassword } from "./loginService.ts"; import { createAccount, createNonce, getUsernameFromEmail, isCorrectPassword } from "./loginService.ts";
@ -44,7 +44,7 @@ export const stopWsServers = (promises: Promise<void>[]): void => {
let lastWsid: number = 0; let lastWsid: number = 0;
interface IWsCustomData extends ws { interface IWsCustomData extends WebSocket {
id: number; id: number;
accountId?: string; accountId?: string;
isGame?: boolean; isGame?: boolean;
@ -90,7 +90,7 @@ interface IWsMsgToClient {
sync_inventory?: boolean; sync_inventory?: boolean;
} }
const wsOnConnect = (ws: ws, req: http.IncomingMessage): void => { const wsOnConnect = (ws: WebSocket, req: http.IncomingMessage): void => {
if (req.url == "/custom/selftest") { if (req.url == "/custom/selftest") {
ws.send("SpaceNinjaServer"); ws.send("SpaceNinjaServer");
ws.close(); ws.close();