codestates / codestates/Donorticon
[Dev Log] socket.io 룸 생성과 입장 및 메세지 전달 프로세스
- Dominant language
- JavaScript
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
*오늘은 어떻게 프로젝트에 기여했나요?*
DM에서 메세지가 소켓에 연결된 모든 사람에게 전달되는 오류를 해결중이다.
소켓에서 메세지를 전체로 보내는 이유는 아래의 코드 때문이다.
socket.broadcast() ==> 해당 메소드는 '나'를 제외한 나머지의 사람들에게 전체 메세지를 보낸다.
io.emit() ==> 해당 메소드는 소켓에 접속해있는 모든이들에게 메세지를 보낸다.
우리 어플에 필요한 기능은 소수의 클라이언트끼리의 대화이므로 '룸'을 설정해줘야 한다.
프로세스는 아래와 같다.
1) 클라이언트에서 서버에게 룸 입장 요청
CLIENT ==> socket.emit("join-room") ==> SERVER ==> socket.on("join-room", () => socket.join(room))
2) 클라이언트는 서버에게 메세지를 보낸다. 이때 별도의 룸 설정은 필요하지 않다. 룸 별로 메세지를 다시 보내는 건 서버의 역할
CLIENT ==> socket.emit("send-message", message) ==> SERVER ==> socket.on("send-message", () => io.to(room).emit(~))
Contributor guide
No contributing guide indexed for this repository
Research direction
No source file or test is named; start by locating the server's socket handlers and the client code that emits join-room and send-message. Trace how the room value is carried into message delivery, then verify that a DM reaches only the intended room members rather than every connected socket.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100