16 lines
460 B
TypeScript
16 lines
460 B
TypeScript
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
|
|
if (socket) {
|
|
socket.emit('notification', { message: 'Something happened with socket' })
|
|
}
|
|
// Use io for broadcasting if needed
|
|
io.emit('notification', { message: 'Something happened' })
|
|
}
|
|
}
|