1
0
forked from noxious/server
noxious_server/src/jobs/someJob.ts
2024-12-28 22:23:04 +01:00

17 lines
461 B
TypeScript

import { Server as SocketServer } from 'socket.io'
import { TSocket } from '#application/types'
export default class SomeJob {
constructor(private params: any) {}
async execute(io: SocketServer, socket?: TSocket) {
// Handle the event
if (socket) {
socket.emit('notification', { message: 'Something happened with socket' })
}
// Use io for broadcasting if needed
io.emit('notification', { message: 'Something happened' })
}
}