Showing
1 changed file
with
7 additions
and
1 deletions
1 | import React, { useCallback, useContext, useEffect, useState } from 'react'; | 1 | import React, { useCallback, useContext, useEffect, useState } from 'react'; |
2 | import { useLocation, useParams } from 'react-router'; | 2 | import { useLocation, useParams } from 'react-router'; |
3 | import SocketContext from '../../contexts/SocketContext'; | 3 | import SocketContext from '../../contexts/SocketContext'; |
4 | -import { MessageType } from '../common/types'; | 4 | +import { MessageResponse, MessageType, RawMessage } from '../common/types'; |
5 | import { RoomData, UpdateRoomUser } from './types'; | 5 | import { RoomData, UpdateRoomUser } from './types'; |
6 | 6 | ||
7 | interface RoomInfoLocation { | 7 | interface RoomInfoLocation { |
... | @@ -47,6 +47,12 @@ export const RoomInfo: React.FC = () => { | ... | @@ -47,6 +47,12 @@ export const RoomInfo: React.FC = () => { |
47 | 47 | ||
48 | return () => { | 48 | return () => { |
49 | socket.off(MessageType.ROOM_USER_UPDATE, handleUpdateRoomUser); | 49 | socket.off(MessageType.ROOM_USER_UPDATE, handleUpdateRoomUser); |
50 | + | ||
51 | + const rawMessage: RawMessage = { | ||
52 | + type: MessageType.ROOM_LEAVE, | ||
53 | + message: '' | ||
54 | + } | ||
55 | + socket.emit('msg', rawMessage, (response : MessageResponse<undefined>) => {}); | ||
50 | } | 56 | } |
51 | }, []); | 57 | }, []); |
52 | 58 | ... | ... |
-
Please register or login to post a comment