forked from noxious/server
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 } from 'socket.io'
|
||||
|
||||
import type { TSocket, UUID } from '#application/types'
|
||||
@ -44,11 +45,11 @@ class MapCharacter {
|
||||
MapManager.removeCharacter(this.character.id)
|
||||
|
||||
// Notify map players
|
||||
io.in(this.character.map.id).emit('map:character:leave', this.character.id)
|
||||
io.in(this.character.map.id).emit(SocketEvent.MAP_CHARACTER_LEAVE, this.character.id)
|
||||
}
|
||||
|
||||
// Notify all players
|
||||
io.emit('character:disconnect', this.character.id)
|
||||
io.emit(SocketEvent.CHARACTER_DISCONNECT, this.character.id)
|
||||
} catch (error) {
|
||||
console.error(`Error disconnecting character ${this.character.id}:`, error)
|
||||
}
|
||||
|
Reference in New Issue
Block a user