|
|
@@ -52,6 +52,7 @@ class SocketIoService {
|
|
|
|
|
|
await this.setupLoginedUserRoomsJoinOnConnection();
|
|
|
await this.setupDefaultSocketJoinRoomsEventHandler();
|
|
|
+ await this.setupDefaultSocketLeaveRoomsEventHandler();
|
|
|
}
|
|
|
|
|
|
getDefaultSocket() {
|
|
|
@@ -150,12 +151,22 @@ class SocketIoService {
|
|
|
setupDefaultSocketJoinRoomsEventHandler() {
|
|
|
this.io.on('connection', (socket) => {
|
|
|
// set event handlers for joining rooms
|
|
|
- socket.on('join:page', ({ pageId }) => {
|
|
|
+ socket.on(SocketEventName.JoinPage, ({ pageId }) => {
|
|
|
+ console.log('こんにちは', pageId);
|
|
|
socket.join(getRoomNameWithId(RoomPrefix.PAGE, pageId));
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ setupDefaultSocketLeaveRoomsEventHandler() {
|
|
|
+ this.io.on('connection', (socket) => {
|
|
|
+ socket.on(SocketEventName.LeavePage, ({ pageId }) => {
|
|
|
+ console.log('さようなら', pageId);
|
|
|
+ socket.leave(getRoomNameWithId(RoomPrefix.PAGE, pageId));
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
setupYjsConnection() {
|
|
|
const yjsConnectionManager = getYjsConnectionManager();
|
|
|
this.io.on('connection', (socket) => {
|