-
-
Save gdyrrahitis/893e48f0ad81c991f6578357c17564cb to your computer and use it in GitHub Desktop.
Events emitted
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ // In createRoom method (line 29-55) | |
// Events are emitted in this order | |
this.emitLoggedUsersToRoom(socket, room); | |
callback({ access: true, roomId: room.id }); | |
this.emitRoomsAllEventWithTotalRooms(); | |
this.emitUsersAllEventWithTotalUsersInAllRooms(); | |
} | |
// method declarations... | |
private emitLoggedUsersToRoom(socket: ISocket, room: Room) { | |
let roomShowAllEvent = new RoomShowAllEvent(room.users); | |
socket.server.to(room.id).emit(RoomShowAllEvent.eventName, roomShowAllEvent.users); | |
} | |
private emitRoomsAllEventWithTotalRooms() { | |
this.io.emit(RoomsAllEvent.eventName, this.rooms.length); | |
} | |
private emitUsersAllEventWithTotalUsersInAllRooms() { | |
this.io.emit(UsersAllEvent.eventName, this.rooms.length ? this.getAllUsersFromAllRooms() : 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment