fix: call event handlers when there is no callback

This commit is contained in:
James Murdza 2024-10-25 19:02:18 -06:00
parent e229dab826
commit a87a4b5160

View File

@ -124,7 +124,8 @@ io.on("connection", async (socket) => {
Object.entries(sandboxManager.handlers()).forEach(([event, handler]) => { Object.entries(sandboxManager.handlers()).forEach(([event, handler]) => {
socket.on(event, async (options: any, callback?: (response: any) => void) => { socket.on(event, async (options: any, callback?: (response: any) => void) => {
try { try {
callback?.(await handler(options)); const result = await handler(options)
callback?.(result);
} catch (e: any) { } catch (e: any) {
handleErrors(`Error processing event "${event}":`, e, socket); handleErrors(`Error processing event "${event}":`, e, socket);
} }