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

인증된 채팅 기능 초안을 추가합니다. #85

Merged
merged 3 commits into from
Jul 29, 2024
Merged

Conversation

litsynp
Copy link
Contributor

@litsynp litsynp commented Jul 28, 2024

#80 에서 추가된 채팅 기능을 참고하고, 일시적으로 해당 코드는 주석처리 했습니다.

현재 가능한 기능은 WS 접속 후 메시지 전송입니다.

WS endpoint는 GET /ws/chat, Authorization 헤더를 넘겨줘야 합니다.

sender.id는 Authorization 헤더에 따라 자동으로 추가됩니다.

Request

User 1이 받는 내용

{
    "room": {
        "id": 1
    },
    "messageType": "plain",
    "message": "hello"
}

Response

User 2가 받는 내용

{
    "user": {
        "id": 1
    },
    "room": {
        "id": 1
    },
    "messageType": "plain",
    "message": "hello",
    "createdAt": "2024-07-28T15:56:14",
    "updatedAt": "2024-07-28T15:56:14"
}

@litsynp litsynp requested a review from JoeCP17 July 28, 2024 10:45
@litsynp litsynp self-assigned this Jul 28, 2024
# Conflicts:
#	cmd/server/router.go
Copy link
Contributor

@JoeCP17 JoeCP17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인했어여 코멘트 확인해주세요!

chatHandler := handler.NewChatController(wsServer, stateManager, authService, *chatService)
// // InMemoryStateManager는 클라이언트와 채팅방의 상태를 메모리에 저장하고 관리합니다.
// // 이 메서드는 단순하고 빠르며 테스트 목적으로 적합합니다.
// // 전략 패턴을 사용하여 이 부분을 다른 상태 관리 구현체로 쉽게 교체할 수 있습니다.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 주석 커맨드로 넣으시면서 중복 발생한거같아여

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넹 어차피 지워질 예정이라 당장은 큰 상관 없을 것 같습니다~

// chatAPIGroup.GET("/ws", func(c echo.Context) error {
// return chatHandler.ServerWebsocket(c, c.Response().Writer, c.Request())
// })
// }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

혹시 해당 부분은 왜 주석으로 되어있나여 ? 만약 사용안하시는거면 지우셔도 되지 않을까 싶슴당

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어느 쪽이 임시가 될지 몰라서요. 일단 남겨둘게요! 에픽 브랜치에서 최종 점검할 때 지우면 될 것 같아요

@litsynp litsynp merged commit 49410ce into epic/chat Jul 29, 2024
2 checks passed
@litsynp litsynp deleted the feat/chat-ws branch July 29, 2024 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants