feat: support websocket connections from game client #2735

Merged
Sainan merged 19 commits from client-ws into main 2025-09-10 00:00:10 -07:00
Showing only changes of commit a6294a0324 - Show all commits

View File

@ -179,17 +179,15 @@ const wsOnConnect = (ws: ws, req: http.IncomingMessage): void => {
logError(e as Error, `processing websocket message`);
}
});
ws.on("close", () => {
// eslint-disable-next-line @typescript-eslint/no-misused-promises
ws.on("close", async () => {
if ((ws as IWsCustomData).isGame && (ws as IWsCustomData).accountId) {
logger.debug(`lost bootstrapper connection for ${(ws as IWsCustomData).accountId}`);
void Account.updateOne(
{
_id: (ws as IWsCustomData).accountId
},
{
Dropped: true
}
).then(() => {});
const account = await Account.findOne({ _id: (ws as IWsCustomData).accountId });
if (account?.Nonce) {
account.Dropped = true;
await account.save();
}
}
});
};