Overnap

방 나갈 때 leaveRoom 전송 추가

import React, { useCallback, useContext, useEffect, useState } from 'react';
import { useLocation, useParams } from 'react-router';
import SocketContext from '../../contexts/SocketContext';
import { MessageType } from '../common/types';
import { MessageResponse, MessageType, RawMessage } from '../common/types';
import { RoomData, UpdateRoomUser } from './types';
interface RoomInfoLocation {
......@@ -47,6 +47,12 @@ export const RoomInfo: React.FC = () => {
return () => {
socket.off(MessageType.ROOM_USER_UPDATE, handleUpdateRoomUser);
const rawMessage: RawMessage = {
type: MessageType.ROOM_LEAVE,
message: ''
}
socket.emit('msg', rawMessage, (response : MessageResponse<undefined>) => {});
}
}, []);
......