Commit 7b2efa8f authored by Soo Hyun Kim's avatar Soo Hyun Kim
Browse files

0126머지후

parents 650999ad 108b1b94
......@@ -7,10 +7,14 @@ const router = express.Router()
router.route('/users/signup')
.post(userCtrl.signup)
router.route('/users/check')
.get(userCtrl.checkUser)
router.route(`/users/:userId`)
.get(userCtrl.getProfile)
.put(userCtrl.profileUpload, userCtrl.update)
router.param('userId', userCtrl.userById)
......
......@@ -33,13 +33,7 @@ io.on("connection", (socket) => { // 기본 연결
let roomInfo = data;
socket.leave(roomInfo); //클라이언트에서 data에 적힌 room정보를 브로드캐스팅 받지 않는다.
});
socket.on('newUser', (data) => {
console.log('newUser', data)
let userInfo = data.userInfo;
io.to(data.rmIf).emit('sendUser', userInfo)
})
socket.on('chat', async (data) => {
console.log('roomname확인', data)
const room = await Room.findOne({ roomId: data.roomInfo })
......@@ -48,13 +42,14 @@ io.on("connection", (socket) => { // 기본 연결
const chat = await new Chat({
room: room._id,
username: data.sendInfo.sender,
message: data.sendInfo.msg
message: data.sendInfo.msg,
profileimg: data.sendInfo.img
}).save()
console.log('resChat확인', chat)
socket.broadcast.to(data.roomInfo).emit('sendedMSG', data.sendInfo); // sender 제외 특정 방으로
});
});
socket.on('disconnect', () => {
console.log('disconnected from server id=', socket.id)
......@@ -75,4 +70,4 @@ server.listen(3030, () => {
})
export default server
// module.exports = server;
// module.exports = server;
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment