fix websocket error (#1208)

## Description:

When updating tunnel creation, the port was switched to 3000, so it
pointed to master, it should be pointed to port 80 (nginx) so that nginx
can route requests to the appropriate worker.

Also fixed some ws handling.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:

DISCORD_USERNAME
This commit is contained in:
evanpelle
2025-06-17 09:46:13 -07:00
committed by GitHub
parent 2d565d16a1
commit 7d93b484bd
2 changed files with 5 additions and 4 deletions
+3 -3
View File
@@ -172,7 +172,7 @@ export class GameServer {
client.isDisconnected = existing.isDisconnected;
client.lastPing = existing.lastPing;
existing.ws.removeAllListeners("message");
existing.ws.removeAllListeners();
this.activeClients = this.activeClients.filter((c) => c !== existing);
}
@@ -183,6 +183,8 @@ export class GameServer {
this.allClients.set(client.clientID, client);
client.ws.removeAllListeners("message");
client.ws.removeAllListeners("close");
client.ws.removeAllListeners("error");
client.ws.on(
"message",
gatekeeper.wsHandler(client.ip, async (message: string) => {
@@ -240,7 +242,6 @@ export class GameServer {
}
}),
);
client.ws.removeAllListeners("close");
client.ws.on("close", () => {
this.log.info("client disconnected", {
clientID: client.clientID,
@@ -250,7 +251,6 @@ export class GameServer {
(c) => c.clientID !== client.clientID,
);
});
client.ws.removeAllListeners("error");
client.ws.on("error", (error: Error) => {
if ((error as any).code === "WS_ERR_UNEXPECTED_RSV_1") {
client.ws.close(1002, "WS_ERR_UNEXPECTED_RSV_1");
+2 -1
View File
@@ -42,7 +42,8 @@ async function setupTunnels() {
const domainToService = new Map<string, string>().set(
config.subdomain(),
`http://localhost:3000`,
// TODO: change to 3000 when we have a proper tunnel setup.
`http://localhost:80`,
);
for (let i = 0; i < config.numWorkers(); i++) {