Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

채널 생성에 대한 로직 고민 #142

Closed
GeonHyeongKim opened this issue Jan 31, 2022 · 2 comments
Closed

채널 생성에 대한 로직 고민 #142

GeonHyeongKim opened this issue Jan 31, 2022 · 2 comments
Assignees
Labels
BE help Extra attention is needed
Projects
Milestone

Comments

@GeonHyeongKim
Copy link
Collaborator

API를 어떤 순서로 불러야할까요?

[개인 1:1 채널 - DM]

  1. get one channel을 통해 자신이 만든(자신의 token을 넣음) 채널을 검색한다.
  2. 있을경우, 없을경우
    2-1. 있을경우 -> 문제 없이 채널 아이디를 통해 입장
    질문) 상대방이 만들어 놓았다면...? get member of on channel을 호출해서 확인해야하나?
    2-2. 없을경우 -> 상대방이 없는지도 확인해본뒤, create channel을 통해 채널을 생성

[3명 이상의 그룹 채널일 경우..?] 위에 과정을 어떻게 정리해야할까요?

@GeonHyeongKim GeonHyeongKim added BE help Extra attention is needed labels Jan 31, 2022
@GeonHyeongKim GeonHyeongKim added this to To do in LastPunch via automation Jan 31, 2022
@GeonHyeongKim GeonHyeongKim added this to the 사이클 3 milestone Jan 31, 2022
@njsh4261
Copy link
Owner

njsh4261 commented Feb 1, 2022

외부 메신저 통해서 따로 답변을 드렸지만, 정리 차원에서 다시 comment로 답변을 드립니다!

  1. 일반 채널의 경우, create channel API를 통해 생성된 채널의 ID를 채팅 서버의 /app/chat API의 body로 전달합니다.
  2. DM의 경우, 별도의 채널 생성 API 호출이 필요하지 않고 [user1]-[user2] 포맷으로 채널 ID를 전달합니다(e.g. 12-45). 이 때 user1과 user2 중에 누가 누구한테 보내는 메시지인지는 채널 ID값에 담는 정보가 아니며, user1의 ID가 user2의 ID보다 항상 작습니다. 12번 사용자가 45번에게 메시지를 보내든, 반대의 경우든 항상 12-45번 채널에 메시지를 보내게 됩니다.

메시지를 보낼 채널 ID를 결정하는 데 필요한 정보는 워크스페이스 1개의 정보를 불러오는 API를 호출하면 해당 워크스페이스에 소속된 채널 목록과 멤버 목록을 함께 얻어올 수 있습니다. 해당 목록들을 프론트엔드에서 저장해 두었다가 채널 ID값이 필요할 때 활용하시면 좋을 것 같습니다!

@chahtk
Copy link
Collaborator

chahtk commented Feb 6, 2022

connect: ws://localhost:8083/ws/chat/websocket (소켓 연결 처음 1회)

=>

원하는 채널 갯수만큼 subscribe
subscirbe: "/topic/channel." + 1
subscirbe: "/topic/channel." + 2
subscirbe: "/topic/channel." + 3
subscirbe: "/topic/channel." + 1-2
subscirbe: "/topic/channel." + 1-3
...

=> 

메시지를 보내는 함수에서 호출
publish: "/app/chat"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BE help Extra attention is needed
Projects
Development

No branches or pull requests

3 participants