Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
messenger
Commits
78b14ec0
Commit
78b14ec0
authored
Jan 25, 2021
by
Choi Ga Young
Browse files
xxxxx
parent
6a3b89dc
Changes
8
Show whitespace changes
Inline
Side-by-side
client/src/Components/Chat.js
View file @
78b14ec0
...
@@ -17,9 +17,6 @@ function Chat(props) {
...
@@ -17,9 +17,6 @@ function Chat(props) {
const
usualTime
=
simpleTime
.
substring
(
0
,
simpleTime
.
length
-
3
)
const
usualTime
=
simpleTime
.
substring
(
0
,
simpleTime
.
length
-
3
)
const
realTime
=
new
Date
().
toISOString
()
const
realTime
=
new
Date
().
toISOString
()
const
r
=
Date
.
parse
(
realTime
)
const
[
disabled
,
setDisabled
]
=
useState
(
true
)
const
[
disabled
,
setDisabled
]
=
useState
(
true
)
const
[
user
,
setUser
]
=
useState
(
''
)
const
[
user
,
setUser
]
=
useState
(
''
)
const
[
error
,
setError
]
=
useState
(
''
);
const
[
error
,
setError
]
=
useState
(
''
);
...
@@ -43,15 +40,6 @@ const r = Date.parse(realTime)
...
@@ -43,15 +40,6 @@ const r = Date.parse(realTime)
catchErrors
(
error
,
setError
)
catchErrors
(
error
,
setError
)
}
}
}
}
// async function sysMsg(roomCode) {
// try {
// let res = await axios.get('/room/sysMsg', { params: { 'roomCode': roomCode } })
// console.log('sysmsg', res.data)
// } catch (error) {
// catchErrors(error, setError)
// }
// }
function
handleChange
(
e
)
{
function
handleChange
(
e
)
{
e
.
preventDefault
()
e
.
preventDefault
()
...
@@ -66,7 +54,6 @@ const r = Date.parse(realTime)
...
@@ -66,7 +54,6 @@ const r = Date.parse(realTime)
props
.
setSingleImg
(
user
.
profileimg
)
props
.
setSingleImg
(
user
.
profileimg
)
props
.
setSingleUser
(
user
.
nickname
)
props
.
setSingleUser
(
user
.
nickname
)
props
.
setSingleChat
(
inner
)
props
.
setSingleChat
(
inner
)
props
.
sendMsg
(
e
)
props
.
sendMsg
(
e
)
setInner
(
''
)
setInner
(
''
)
setDisabled
(
true
)
setDisabled
(
true
)
...
@@ -81,7 +68,7 @@ const r = Date.parse(realTime)
...
@@ -81,7 +68,7 @@ const r = Date.parse(realTime)
console
.
log
(
'
chat2
'
,
chat
)
console
.
log
(
'
chat2
'
,
chat
)
props
.
handleChatc
()
props
.
handleChatc
()
props
.
setLeaveInfo
([...
props
.
leaveInfo
,
{
roomName
:
props
.
roomCode
,
leaveTime
:
realTime
}])
props
.
setLeaveInfo
([...
props
.
leaveInfo
,
{
roomName
:
props
.
roomCode
,
leaveTime
:
realTime
}])
console
.
log
(
'
나간시간
'
,
realTime
,
usualTime
)
console
.
log
(
'
나간시간
'
,
realTime
,
usualTime
)
}
}
function
settingtime
(
hour
)
{
function
settingtime
(
hour
)
{
...
@@ -98,30 +85,46 @@ const r = Date.parse(realTime)
...
@@ -98,30 +85,46 @@ const r = Date.parse(realTime)
return
newhour
return
newhour
}
}
//이전 채팅 내용에 대한 것 불러오기
//이전 채팅 내용에 대한 것 불러오기
//프사 닉네임 메세지가 각각의 배열로 들어가서 띄워지는 방식
//프사 닉네임 메세지가 각각의 배열로 들어가서 띄워지는 방식
async
function
getPreviousChat
()
{
async
function
getPreviousChat
()
{
//메세지, 닉네임, 시간 불러오기
//메세지, 닉네임, 시간 불러오기
const
respond
=
await
axios
.
get
(
'
/room/getChatInfo
'
,
{
params
:
{
'
roomCode
'
:
props
.
roomCode
}
})
const
respond
=
await
axios
.
get
(
'
/room/getChatInfo
'
,
{
params
:
{
'
roomCode
'
:
props
.
roomCode
}
})
console
.
log
(
respond
)
const
info
=
respond
.
data
const
info
=
respond
.
data
let
chatlist
=
[]
let
chatlist
=
[]
let
userlist
=
[]
let
userlist
=
[]
let
timelist
=
[]
let
timelist
=
[]
let
imglist
=
[]
let
imglist
=
[]
let
intlist
=
[]
for
(
let
i
=
0
;
i
<=
info
.
length
-
1
;
i
++
)
{
//사용하려는 형식에 맞게 수정
for
(
let
i
=
0
;
i
<=
info
.
length
-
1
;
i
++
)
{
//사용하려는 형식에 맞게 수정
chatlist
=
[...
chatlist
,
info
[
i
].
message
]
chatlist
=
[...
chatlist
,
info
[
i
].
message
]
//userlist = [...userlist, info[i].username]
if
(
info
[
i
].
username
===
"
system
"
)
{
userlist
=
[...
userlist
,
""
]
intlist
.
push
(
i
)
// continue;
}
else
{
userlist
=
[...
userlist
,
info
[
i
].
username
]
userlist
=
[...
userlist
,
info
[
i
].
username
]
}
timelist
=
[...
timelist
,
info
[
i
].
createdAt
]
timelist
=
[...
timelist
,
info
[
i
].
createdAt
]
// console.log('int', intlist)
// console.log('timelist', timelist)
let
hour
=
timelist
[
i
].
split
(
'
T
'
)[
1
].
split
(
'
:
'
)
let
hour
=
timelist
[
i
].
split
(
'
T
'
)[
1
].
split
(
'
:
'
)
timelist
[
i
]
=
settingtime
(
hour
[
0
])
+
'
:
'
+
hour
[
1
]
timelist
[
i
]
=
settingtime
(
hour
[
0
])
+
'
:
'
+
hour
[
1
]
}
}
console
.
log
(
'
userlist확인
'
,
userlist
)
//그 nick에 맞는 프사 불러오기
//그 nick에 맞는 프사 불러오기
const
respond2
=
await
axios
.
get
(
'
/room/getProfileImage
'
,
{
params
:
{
'
userlist
'
:
userlist
}
})
const
respond2
=
await
axios
.
get
(
'
/room/getProfileImage
'
,
{
params
:
{
'
userlist
'
:
userlist
}
})
const
imginfo
=
respond2
.
data
const
imginfo
=
respond2
.
data
for
(
let
j
=
0
;
j
<=
imginfo
.
length
-
1
;
j
++
)
{
for
(
let
j
=
0
;
j
<=
imginfo
.
length
-
1
;
j
++
)
{
if
(
intlist
.
indexOf
(
j
)
<
0
)
{
imglist
=
[...
imglist
,
imginfo
[
j
][
0
].
profileimg
]
imglist
=
[...
imglist
,
imginfo
[
j
][
0
].
profileimg
]
}
else
{
imglist
=
[...
imglist
,
""
]
}
}
}
setChat
(
chatlist
)
setChat
(
chatlist
)
setSender
(
userlist
)
setSender
(
userlist
)
...
@@ -153,7 +156,6 @@ const r = Date.parse(realTime)
...
@@ -153,7 +156,6 @@ const r = Date.parse(realTime)
useEffect
(()
=>
{
useEffect
(()
=>
{
getRoomName
(
props
.
roomCode
)
getRoomName
(
props
.
roomCode
)
//sysMsg(props.roomCode)
console
.
log
(
'
겟 룸네임
'
,
chat
)
console
.
log
(
'
겟 룸네임
'
,
chat
)
},
[
props
.
roomCode
])
},
[
props
.
roomCode
])
...
@@ -174,7 +176,7 @@ const r = Date.parse(realTime)
...
@@ -174,7 +176,7 @@ const r = Date.parse(realTime)
{
chat
.
map
((
value
,
index
)
=>
{
{
chat
.
map
((
value
,
index
)
=>
{
if
(
!
(
value
==
''
))
{
if
(
!
(
value
==
''
))
{
if
(
!
(
sender
[
index
]
===
user
.
nickname
))
{
if
(
!
(
sender
[
index
]
===
user
.
nickname
))
{
return
(
return
(
//상대편 메시지
<
Row
key
=
{
index
}
className
=
'
m-1
'
>
<
Row
key
=
{
index
}
className
=
'
m-1
'
>
<
Col
xs
=
{
2
}
>
<
Col
xs
=
{
2
}
>
<
Image
src
=
{
img
&&
`/images/
${
img
[
index
]}
`
}
style
=
{{
width
:
"
50px
"
,
height
:
"
50px
"
}}
roundedCircle
/>
<
Image
src
=
{
img
&&
`/images/
${
img
[
index
]}
`
}
style
=
{{
width
:
"
50px
"
,
height
:
"
50px
"
}}
roundedCircle
/>
...
@@ -188,8 +190,12 @@ const r = Date.parse(realTime)
...
@@ -188,8 +190,12 @@ const r = Date.parse(realTime)
<
/Col
>
<
/Col
>
<
/Row
>
<
/Row
>
)
)
}
else
{
}
else
if
(
sender
[
index
]
===
""
)
{
return
(
return
(
{
value
}
)
}
else
{
return
(
//내가 보낸 메시지
<
Row
key
=
{
index
}
className
=
'
m-1 justify-content-end
'
>
<
Row
key
=
{
index
}
className
=
'
m-1 justify-content-end
'
>
<
Row
className
=
'
d-flex flex-wrap-nowrap
'
>
<
Row
className
=
'
d-flex flex-wrap-nowrap
'
>
<
Col
className
=
'
mr-1
'
>
{
time
[
index
]}
<
/Col
>
<
Col
className
=
'
mr-1
'
>
{
time
[
index
]}
<
/Col
>
...
...
client/src/Components/ClosedList.js
View file @
78b14ec0
...
@@ -51,7 +51,7 @@ function ClosedList(props) {
...
@@ -51,7 +51,7 @@ function ClosedList(props) {
<
ListGroup
key
=
{
index
}
>
<
ListGroup
key
=
{
index
}
>
<
ListGroup
.
Item
action
onClick
=
{
enterChatRoomCH
}
name
=
{
item
.
roomId
}
value
=
{
item
.
roomName
}
>
<
ListGroup
.
Item
action
onClick
=
{
enterChatRoomCH
}
name
=
{
item
.
roomId
}
value
=
{
item
.
roomName
}
>
{
item
.
roomName
}
{
item
.
roomName
}
<
Badge
className
=
'
ml-2
'
pill
variant
=
'
danger
'
>
8
<
/Badge
>
{
/*
<Badge className='ml-2' pill variant='danger'>8</Badge>
*/
}
<
/ListGroup.Item
>
<
/ListGroup.Item
>
<
/ListGroup
>
<
/ListGroup
>
)}
)}
...
...
client/src/Components/EnterRoom.js
View file @
78b14ec0
...
@@ -8,8 +8,7 @@ function EnterRoom(props) {
...
@@ -8,8 +8,7 @@ function EnterRoom(props) {
const
[
enterCode
,
setEnterCode
]
=
useState
(
''
);
const
[
enterCode
,
setEnterCode
]
=
useState
(
''
);
const
[
error
,
setError
]
=
useState
(
''
);
const
[
error
,
setError
]
=
useState
(
''
);
const
userId
=
sessionStorage
.
getItem
(
'
userId
'
);
//sessionStorage에 저장된 userId가져옴
const
userId
=
sessionStorage
.
getItem
(
'
userId
'
);
function
handleChange
(
event
)
{
function
handleChange
(
event
)
{
const
{
name
,
value
}
=
event
.
target
const
{
name
,
value
}
=
event
.
target
...
@@ -23,13 +22,17 @@ function EnterRoom(props) {
...
@@ -23,13 +22,17 @@ function EnterRoom(props) {
setError
(
''
)
setError
(
''
)
let
res
=
await
axios
.
post
(
'
/room/enterRoom
'
,
{
enterCode
})
let
res
=
await
axios
.
post
(
'
/room/enterRoom
'
,
{
enterCode
})
await
axios
.
put
(
'
/room/member
'
,
{
userId
:
userId
,
roomId
:
enterCode
})
await
axios
.
put
(
'
/room/member
'
,
{
userId
:
userId
,
roomId
:
enterCode
})
const
response
=
await
axios
.
get
(
'
/users/check
'
,
{
params
:
{
'
_id
'
:
userId
}
})
// console.log('res확인22', response.data.nickname)
const
userNick
=
response
.
data
.
nickname
;
props
.
setRoomName
(
res
.
data
)
props
.
setRoomName
(
res
.
data
)
props
.
setRoomCode
(
enterCode
)
props
.
setRoomCode
(
enterCode
)
props
.
setSysmsg
(
`
${
userNick
}
님이 들어왔습니다.`
)
props
.
enterChatRoom
(
enterCode
)
props
.
enterChatRoom
(
enterCode
)
props
.
handleCloseEnter
()
props
.
handleCloseEnter
()
props
.
handleChato
()
props
.
handleChato
()
setEnterCode
(
''
)
setEnterCode
(
''
)
}
catch
(
error
){
}
catch
(
error
)
{
catchErrors
(
error
,
setError
)
catchErrors
(
error
,
setError
)
}
}
}
}
...
...
client/src/Components/RoomMake.js
View file @
78b14ec0
...
@@ -23,7 +23,7 @@ function RoomMake(props) {
...
@@ -23,7 +23,7 @@ function RoomMake(props) {
function
handleChange
(
event
)
{
function
handleChange
(
event
)
{
const
{
name
,
value
}
=
event
.
target
const
{
name
,
value
}
=
event
.
target
setRoom
({
...
room
,
[
name
]:
value
,
member
})
setRoom
({
...
room
,
[
name
]:
value
,
member
})
console
.
log
(
room
)
//
console.log(room)
}
}
async
function
handleSubmit
(
event
)
{
async
function
handleSubmit
(
event
)
{
...
...
client/src/Pages/HomePage.js
View file @
78b14ec0
...
@@ -33,6 +33,7 @@ function Home() {
...
@@ -33,6 +33,7 @@ function Home() {
const
[
singleChat
,
setSingleChat
]
=
useState
(
''
)
const
[
singleChat
,
setSingleChat
]
=
useState
(
''
)
const
[
recievedMsg
,
setRecievedMsg
]
=
useState
(
''
)
const
[
recievedMsg
,
setRecievedMsg
]
=
useState
(
''
)
const
[
roomCode
,
setRoomCode
]
=
useState
(
''
)
const
[
roomCode
,
setRoomCode
]
=
useState
(
''
)
const
[
sysmsg
,
setSysmsg
]
=
useState
(
''
)
const
[
singleUser
,
setSingleUser
]
=
useState
(
''
)
const
[
singleUser
,
setSingleUser
]
=
useState
(
''
)
const
[
recievedUser
,
setRecievedUser
]
=
useState
(
''
)
const
[
recievedUser
,
setRecievedUser
]
=
useState
(
''
)
...
@@ -49,17 +50,7 @@ function Home() {
...
@@ -49,17 +50,7 @@ function Home() {
async
function
enterChatRoom
(
rCode
)
{
//방 입장하기
async
function
enterChatRoom
(
rCode
)
{
//방 입장하기
socket
.
emit
(
'
joinRoom
'
,
rCode
)
socket
.
emit
(
'
joinRoom
'
,
rCode
)
socket
.
emit
(
'
newUser
'
,
{
rmIf
:
rCode
,
userInfo
:
userName
})
socket
.
emit
(
'
newUser
'
,
{
rmIf
:
rCode
,
userInfo
:
userName
})
// let res = await axios.get('/users/check', { params: { '_id': userId } })
// console.log('res형태 확인', res.data)
// if (res.data) {
// socket.emit('joinRoom', rCode)
// } else {
// socket.emit('joinRoom', rCode)
// socket.emit('access', { rmIf: rCode, userInfo: userId })
// }
// console.log(`joinRoom : ${rCode} 입장`)
console
.
log
(
`joinRoom :
${
rCode
}
입장`
)
console
.
log
(
`joinRoom :
${
rCode
}
입장`
)
console
.
log
(
'
123123방입ㄴ장
'
)
//여기서 채팅 불러와서 넘겨주던가 해야할거 같은데
//여기서 채팅 불러와서 넘겨주던가 해야할거 같은데
}
}
const
[
roomName
,
setRoomName
]
=
useState
(
''
)
const
[
roomName
,
setRoomName
]
=
useState
(
''
)
...
@@ -71,29 +62,27 @@ function Home() {
...
@@ -71,29 +62,27 @@ function Home() {
const
handleChato
=
()
=>
setChat
(
true
);
const
handleChato
=
()
=>
setChat
(
true
);
const
handleChatc
=
()
=>
setChat
(
false
);
const
handleChatc
=
()
=>
setChat
(
false
);
// socket.on("sendUser", (data) => {
// setNewUser(data)
// })
//오픈채팅방에서 참가하기
//오픈채팅방에서 참가하기
async
function
openListroom
(
roomId
)
{
async
function
openListroom
(
roomId
)
{
console
.
log
(
roomId
)
console
.
log
(
roomId
)
const
roomInf
=
await
axios
.
get
(
'
/room/changeMem
'
,
{
params
:
{
'
roomId
'
:
roomId
}
})
const
roomInf
=
await
axios
.
get
(
'
/room/changeMem
'
,
{
params
:
{
'
roomId
'
:
roomId
}
})
console
.
log
(
roomInf
)
//
console.log(roomInf)
console
.
log
(
roomInf
.
data
)
//
console.log(roomInf.data)
console
.
log
(
roomInf
.
data
[
0
])
//
console.log(roomInf.data[0])
setRoom
(
roomInf
.
data
[
0
])
setRoom
(
roomInf
.
data
[
0
])
setOpen
(
true
)
setOpen
(
true
)
setShow
(
false
)
setShow
(
false
)
}
}
async
function
attendListRoom
()
{
async
function
attendListRoom
()
{
const
userId
=
sessionStorage
.
getItem
(
'
userId
'
);
//sessionStorage에 저장된 userId가져옴
const
roomId
=
room
.
roomId
const
roomId
=
room
.
roomId
const
tf
=
await
axios
.
put
(
'
/room/changeMem
'
,
{
userId
:
userId
,
roomId
:
roomId
})
const
tf
=
await
axios
.
put
(
'
/room/changeMem
'
,
{
userId
:
userId
,
roomId
:
roomId
})
const
response
=
await
axios
.
get
(
'
/users/check
'
,
{
params
:
{
'
_id
'
:
userId
}
})
const
userNick
=
response
.
data
.
nickname
;
if
(
tf
.
data
)
{
if
(
tf
.
data
)
{
alert
(
'
참가되었습니다.
'
)
alert
(
'
참가되었습니다.
'
)
setSysmsg
(
`
${
userNick
}
님이 들어왔습니다.`
)
}
else
{
}
else
{
alert
(
'
이미 참가된 방입니다.
'
)
alert
(
'
이미 참가된 방입니다.
'
)
}
}
...
@@ -122,6 +111,20 @@ function Home() {
...
@@ -122,6 +111,20 @@ function Home() {
}
}
},
[
singleChat
])
},
[
singleChat
])
useEffect
(()
=>
{
if
(
!
(
sysmsg
==
''
))
{
socket
.
emit
(
"
chat
"
,
{
roomInfo
:
roomCode
,
sendInfo
:
{
msg
:
sysmsg
,
sender
:
"
system
"
,
// time: singleTime
}
})
setSysmsg
(
''
)
}
},
[
sysmsg
])
useEffect
(()
=>
{
useEffect
(()
=>
{
socket
.
on
(
"
sendedMSG
"
,
(
sendInfo
)
=>
{
socket
.
on
(
"
sendedMSG
"
,
(
sendInfo
)
=>
{
...
@@ -178,7 +181,7 @@ function Home() {
...
@@ -178,7 +181,7 @@ function Home() {
<
/Col
>
<
/Col
>
<
/Row
>
<
/Row
>
<
RoomMake
showModal
=
{
showModal
}
handleCloseModal
=
{
handleCloseModal
}
/
>
<
RoomMake
showModal
=
{
showModal
}
handleCloseModal
=
{
handleCloseModal
}
/
>
<
EnterRoom
showEnter
=
{
showEnter
}
enterChatRoom
=
{
enterChatRoom
}
handleCloseEnter
=
{
handleCloseEnter
}
handleChato
=
{
handleChato
}
setRoomCode
=
{
setRoomCode
}
setRoomName
=
{
setRoomName
}
/
>
<
EnterRoom
showEnter
=
{
showEnter
}
enterChatRoom
=
{
enterChatRoom
}
handleCloseEnter
=
{
handleCloseEnter
}
handleChato
=
{
handleChato
}
setRoomCode
=
{
setRoomCode
}
setRoomName
=
{
setRoomName
}
sysmsg
=
{
sysmsg
}
setSysmsg
=
{
setSysmsg
}
/
>
<
/
>
<
/
>
);
);
}
}
...
...
server/controllers/room.controller.js
View file @
78b14ec0
...
@@ -105,7 +105,6 @@ const changemember = async (req, res) => {
...
@@ -105,7 +105,6 @@ const changemember = async (req, res) => {
else
{
else
{
return
res
.
json
(
false
)
return
res
.
json
(
false
)
}
}
res
.
end
()
}
catch
(
error
)
{
}
catch
(
error
)
{
res
.
status
(
500
).
send
(
'
멤버 업데이트 실패
'
)
res
.
status
(
500
).
send
(
'
멤버 업데이트 실패
'
)
}
}
...
...
server/controllers/user.controller.js
View file @
78b14ec0
...
@@ -86,8 +86,7 @@ const getProfile = (req, res) => {
...
@@ -86,8 +86,7 @@ const getProfile = (req, res) => {
const
checkUser
=
async
(
req
,
res
)
=>
{
const
checkUser
=
async
(
req
,
res
)
=>
{
try
{
try
{
const
info
=
await
User
.
findOne
({
_id
:
req
.
query
.
_id
})
const
info
=
await
AccessInfo
.
findOne
({
userInfo
:
req
.
query
.
_id
})
console
.
log
(
'
info 확인
'
,
info
)
console
.
log
(
'
info 확인
'
,
info
)
return
res
.
json
(
info
)
return
res
.
json
(
info
)
}
catch
(
error
)
{
}
catch
(
error
)
{
...
...
server/server.js
View file @
78b14ec0
...
@@ -11,7 +11,6 @@ import cors from "cors"
...
@@ -11,7 +11,6 @@ import cors from "cors"
import
Room
from
'
./models/Room.js
'
import
Room
from
'
./models/Room.js
'
import
Chat
from
"
./models/Chat.js
"
import
Chat
from
"
./models/Chat.js
"
import
User
from
"
./models/User.js
"
import
User
from
"
./models/User.js
"
import
AccessInfo
from
"
./models/AccessInfo.js
"
connectDb
()
connectDb
()
...
@@ -30,21 +29,6 @@ io.on("connection", (socket) => { // 기본 연결
...
@@ -30,21 +29,6 @@ io.on("connection", (socket) => { // 기본 연결
socket
.
join
(
roomInfo
);
//클라이언트에서 data에 적힌 room으로 참여시킴
socket
.
join
(
roomInfo
);
//클라이언트에서 data에 적힌 room으로 참여시킴
});
});
// socket.on('access', async (data) => {
// console.log('access', data)
// const nick = await User.findOne({ _id: data.userInfo }).select('nickname').exec()
// const room = await Room.findOne({ roomId: data.rmIf })
// console.log('room확인2', room)
// //console.log('nick확인', nick) //{ _id: 5ffe897927a051f4bc17bbcc, nickname: 'rkyoung1' }
// const accessInfo = await new AccessInfo({
// room: room._id,
// userInfo: data.userInfo,
// nickname: nick.nickname,
// isEnt: true
// }).save()
// console.log('acc확인', accessInfo)
// })
socket
.
on
(
'
chat
'
,
async
(
data
)
=>
{
socket
.
on
(
'
chat
'
,
async
(
data
)
=>
{
console
.
log
(
'
roomname확인
'
,
data
)
console
.
log
(
'
roomname확인
'
,
data
)
const
room
=
await
Room
.
findOne
({
roomId
:
data
.
roomInfo
})
const
room
=
await
Room
.
findOne
({
roomId
:
data
.
roomInfo
})
...
@@ -58,7 +42,7 @@ io.on("connection", (socket) => { // 기본 연결
...
@@ -58,7 +42,7 @@ io.on("connection", (socket) => { // 기본 연결
console
.
log
(
'
resChat확인
'
,
chat
)
console
.
log
(
'
resChat확인
'
,
chat
)
socket
.
broadcast
.
to
(
data
.
roomInfo
).
emit
(
'
sendedMSG
'
,
data
.
sendInfo
);
// sender 제외 특정 방으로
socket
.
broadcast
.
to
(
data
.
roomInfo
).
emit
(
'
sendedMSG
'
,
data
.
sendInfo
);
// sender 제외 특정 방으로
console
.
log
(
'
broad cst실핼
'
)
});
});
socket
.
on
(
'
disconnect
'
,
()
=>
{
socket
.
on
(
'
disconnect
'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment