Replaced all event names with numbers for less bandwidth usage
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import { SocketEvent } from '#application/enums';
|
||||
import { Server as SocketServer } from 'socket.io'
|
||||
|
||||
import type { TSocket } from '#application/types'
|
||||
@ -8,9 +9,9 @@ export default class SomeJob {
|
||||
async execute(io: SocketServer, socket?: TSocket) {
|
||||
// Handle the event
|
||||
if (socket) {
|
||||
socket.emit('notification', { message: 'Something happened with socket' })
|
||||
socket.emit(SocketEvent.NOTIFICATION, { message: 'Something happened with socket' })
|
||||
}
|
||||
// Use io for broadcasting if needed
|
||||
io.emit('notification', { message: 'Something happened' })
|
||||
io.emit(SocketEvent.NOTIFICATION, { message: 'Something happened' })
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user