Skip to content

refactor: WebSocket 공용 모듈 분리 및 ChatGateway 역할 축소#164

Merged
jihuuuu merged 6 commits intodevfrom
feat/active-now
Feb 19, 2026
Merged

refactor: WebSocket 공용 모듈 분리 및 ChatGateway 역할 축소#164
jihuuuu merged 6 commits intodevfrom
feat/active-now

Conversation

@jihuuuu
Copy link
Copy Markdown
Contributor

@jihuuuu jihuuuu commented Feb 19, 2026

이슈 번호

close #163

주요 변경사항

  • WebSocket 공용 레이어(WebsocketCommonModule) 분리 및 AppModule 등록
  • WsAuthService/WsUserGuard 도입으로 소켓 인증/가드 로직 공통화
  • PresenceStore(토큰) + InMemory 구현체 추가 및 Gateway에서 connect/disconnect/touch 연동
  • WS 유틸(룸 네이밍/파싱) 분리로 chat.gateway.ts 책임 축소

테스트 결과 (스크린샷)

로컬 웹소켓 정상 동작 확인
image

참고 및 개선사항

  • infra/ 파일들 활용해서 WS 기반 matches 추천에 활동중 필터링 적용 가능

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 532a7f1f1b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +74 to +75
} catch {
return null;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve WebSocket auth failures in logs

attachUser() now swallows every verification/DB exception with catch { return null; }, so handleConnection() can only log a generic auth failure and operators lose the real failure cause (e.g., DB outage, bad JWT secret, Prisma error). This is a regression from the previous flow where these exceptions were logged, and it makes production incidents much harder to diagnose.

Useful? React with 👍 / 👎.

Comment on lines +62 to +65
} else if (exception instanceof Error) {
if (process.env.NODE_ENV !== 'production' && exception.message) {
message = exception.message;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Log unexpected errors in WebSocket exception filter

The new gateway-wide WsExceptionFilter catches all handler errors and emits an exception event, but it never logs unexpected server-side exceptions. Because this replaces Nest's default WS exception handling for this gateway, runtime bugs can become silent on the server (client only receives a generic SYS-001), which materially hurts observability and incident response.

Useful? React with 👍 / 👎.

@jihuuuu jihuuuu merged commit 8a92b3a into dev Feb 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor] WebSocket 공용 레이어 구축

1 participant