Skip to content

Commit

Permalink
fix: socket io event mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
kuoche1712003 committed Dec 17, 2023
1 parent 901d578 commit 786220a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,11 @@ class SocketIOEventHandler(
}


socketIOServer.addEventListener(SocketIOEventName.LEAVE_ROOM.eventName, SocketioEvent::class.java) {
client: SocketIOClient, socketioEvent: SocketioEvent, _ ->
socketIOServer.addEventListener(SocketIOEventName.LEAVE_ROOM.eventName, ChatData::class.java) {
client: SocketIOClient, socketioEvent: ChatData, _ ->
// ECHO
logger.info(" LEAVE_ROOM Received message: ${socketioEvent.data.target} from client: ${client.sessionId}")

client.leaveRoom(socketioEvent.data.target)
socketIOServer.removeNamespace(socketioEvent.data.target)
logger.info(" LEAVE_ROOM Received message: ${socketioEvent.target} from client: ${client.sessionId}")
client.leaveRoom(socketioEvent.target)
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class WebSocketEventBus(
events.asSequence()
.mapNotNull { RoomEvent::class.safeCast(it) }
.forEach {
socketIOServer.getRoomOperations(it.getRoomId().value)
socketIOServer.getRoomOperations("ROOM_${it.getRoomId().value}")
.sendEvent(it.type.eventName, it.getEventData())
}
}
Expand Down

0 comments on commit 786220a

Please sign in to comment.