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

Commit

Permalink
Merge pull request #231 from KennethTrecy/socket_transaction_fix
Browse files Browse the repository at this point in the history
Socket transaction fix
  • Loading branch information
lemredd authored Oct 15, 2022
2 parents 39e50a0 + 43b52ad commit 120e0d2
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 120e0d2

Please sign in to comment.