Working proof of concept for queue
This commit is contained in:
16
src/jobs/SomeJob.ts
Normal file
16
src/jobs/SomeJob.ts
Normal 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' })
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user