From 43b52ad5b08cc777808e5faae4b016882d0b5000 Mon Sep 17 00:00:00 2001 From: Kenneth Trecy Tobias <19201.tobias.kennethtrecy.c@gmail.com> Date: Sat, 15 Oct 2022 20:32:29 +0800 Subject: [PATCH] intrn(server): destroy transaction upon connection to web socket server --- server/ws/register_chat_events.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server/ws/register_chat_events.ts b/server/ws/register_chat_events.ts index d54d9015d..721315e08 100644 --- a/server/ws/register_chat_events.ts +++ b/server/ws/register_chat_events.ts @@ -1,8 +1,10 @@ +import type { Request } from "!/types/dependent" + import Log from "$!/singletons/log" import { Server } from "socket.io" export default function(wsServer: Server) { - wsServer.on("connection", (socket) => { + wsServer.on("connection", socket => { socket.onAny((event, ...args) => { Log.debug("server", `Listening ${event} with ${JSON.stringify(args)}`) }) @@ -11,7 +13,10 @@ export default function(wsServer: Server) { }) function listenOnDynamicNamespace(namespace: RegExp, logMessage: string) { - wsServer.of(namespace).on("connection", () => { + wsServer.of(namespace).on("connection", socket => { + const request = socket.request as Request + + request.transaction.destroySuccessfully() Log.debug("server", logMessage) }) }