1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-10 12:42:44 +01:00
This commit is contained in:
Madeline 2022-09-16 13:51:32 +10:00
parent 17922d1d1b
commit 3866c7a2a3

View File

@ -22,18 +22,18 @@ export class Server {
}); });
} }
this.server.on("upgrade", (request, socket, head) => { // this.server.on("upgrade", (request, socket, head) => {
if (!request.url?.includes("voice")) return; // if (!request.url?.includes("voice")) return;
this.ws.handleUpgrade(request, socket, head, (socket) => { // this.ws.handleUpgrade(request, socket, head, (socket) => {
// @ts-ignore // // @ts-ignore
socket.server = this; // socket.server = this;
this.ws.emit("connection", socket, request); // this.ws.emit("connection", socket, request);
}); // });
}); // });
this.ws = new ws.Server({ this.ws = new ws.Server({
maxPayload: 1024 * 1024 * 100, maxPayload: 1024 * 1024 * 100,
noServer: true server: this.server,
}); });
this.ws.on("connection", Connection); this.ws.on("connection", Connection);
this.ws.on("error", console.error); this.ws.on("error", console.error);