Working proof of concept for queue

This commit is contained in:
2024-09-22 00:20:49 +02:00
parent 9d6de8a1a9
commit 9f7c48f2c2
4 changed files with 28 additions and 19 deletions

16
src/jobs/SomeJob.ts Normal file
View File

@ -0,0 +1,16 @@
import { TSocket } from '../utilities/types'
import { Server as SocketServer } from 'socket.io'
export default class SomeJob {
constructor(private params: any) {}
async execute(io: SocketServer, socket?: TSocket) {
// Handle the event
console.log('Event params:', this.params)
if (socket) {
socket.emit('notification', { message: 'Something happened with socket' })
}
// Use io for broadcasting if needed
io.emit('notification', { message: 'Something happened' })
}
}