Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
intrn(server): destroy transaction upon connection to web socket server
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Oct 15, 2022
1 parent 84e0206 commit 43b52ad
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions server/ws/register_chat_events.ts
Original file line number Diff line number Diff line change
@@ -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)}`)
})
Expand All @@ -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)
})
}
Expand Down

0 comments on commit 43b52ad

Please sign in to comment.