完成http、https修改

This commit is contained in:
2026-05-17 22:07:07 +08:00
parent 7ff53c2cfd
commit a8ceb194f6
5 changed files with 38 additions and 20 deletions

View File

@@ -1,10 +1,11 @@
import * as websocket from "ws";
import { Server } from 'http';
import { Server as HttpServer } from 'http';
import { Server as HttpsServer } from 'https';
import * as handler from "./class/websockethandler";
import { log, LogLevel } from './log';
export default class WSSignaling {
server: Server;
server: HttpServer | HttpsServer;
wss: websocket.Server;
/**
@@ -12,7 +13,7 @@ export default class WSSignaling {
* @param server HTTP服务器实例
* @param mode 通信模式public或private
*/
constructor(server: Server, mode: string) {
constructor(server: HttpServer | HttpsServer, mode: string) {
// 保存服务器实例
this.server = server;
// 创建WebSocket服务器