Skip to content

Commit

Permalink
fix: connect and disconnect room issues
Browse files Browse the repository at this point in the history
  • Loading branch information
adarshaacharya committed Oct 13, 2021
1 parent b5a93bb commit 5736eb0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions client/src/_context/room/room.state.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const RoomState: React.FC = ({ children }) => {
payload: room,
});
history.push(`/room/${room._id}`);
message.success('New room created ! 🔥 ');
});
setRoomUser(username); // set username in state
} catch (error) {
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/CreateRoom/CreateRoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const CreateRoom = () => {

const onFormSubmit = (values: IVal) => {
createRoom(values);
playIpl();
message.success('New room created ! 🔥 ');
// playIpl();
// message.success('New room created ! 🔥 ');
};

const [form] = Form.useForm();
Expand Down
4 changes: 2 additions & 2 deletions client/src/constants/sockets.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const SOCKETS_EVENT = `socket.event`;

export const SOCKETS_EVENT_CONNECTED = `${SOCKETS_EVENT}.connection`;
export const SOCKETS_EVENT_DISCONNECTED = `${SOCKETS_EVENT}.disconnect`;
export const SOCKETS_EVENT_CONNECTED = `connect`;
export const SOCKETS_EVENT_DISCONNECTED = `disconnect`;
export const SOCKETS_EVENT_CONNECTION_ERROR = `${SOCKETS_EVENT}.connection.error`;

export const SOCKETS_EVENT_USER_JOINED = `${SOCKETS_EVENT}.join.room`;
Expand Down
4 changes: 2 additions & 2 deletions server/constants/sockets.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const SOCKETS_EVENT = `socket.event`;

export const SOCKETS_EVENT_CONNECTED = `${SOCKETS_EVENT}.connection`;
export const SOCKETS_EVENT_DISCONNECTED = `${SOCKETS_EVENT}.disconnect`;
export const SOCKETS_EVENT_CONNECTED = `connection`;
export const SOCKETS_EVENT_DISCONNECTED = `disconnect`;
export const SOCKETS_EVENT_CONNECTION_ERROR = `${SOCKETS_EVENT}.connection.error`;

export const SOCKETS_EVENT_USER_JOINED = `${SOCKETS_EVENT}.join.room`;
Expand Down
1 change: 1 addition & 0 deletions server/controllers/room.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ const socketio = (server: Server) => {

io.to(roomID).emit(SOCKETS_EVENTS_UPDATE_OUTPUT, output.data);
} catch (error) {
// @ts-ignore
console.log(error.message);
}
});
Expand Down

0 comments on commit 5736eb0

Please sign in to comment.