Websocketバックエンド実装 - #202
Conversation
9a324b1 to
f1c19dc
Compare
f1c19dc to
20767d6
Compare
4a9b424 to
dc6de98
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR implements WebSocket backend infrastructure for real-time communication. It introduces two separate WebSocket channels (WebSocketDonChannel and WebSocketOrderChannel) aligned with AsyncAPI specifications, following a channel-based architecture where don-related operations are handled by the don channel and order-related operations by the order channel.
- Implements WebSocket communication channels for don and order state notifications
- Adds comprehensive test coverage for WebSocket functionality
- Enhances logger configuration with environment-specific settings
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/backend/src/websocket/donChannel.ts | Implements WebSocket channel for don state notifications with subscription management |
| packages/backend/src/websocket/orderChannel.ts | Implements WebSocket channel for order state notifications with include option support |
| packages/backend/src/websocket/messages.ts | Defines TypeScript types for WebSocket message schemas per AsyncAPI spec |
| packages/backend/src/utils/logger.ts | Enhances logger with metadata support and test-specific log level configuration |
| packages/backend/src/utils/errorMessage.ts | Adds utility function for formatting typia validation errors |
| packages/backend/src/index.ts | Integrates WebSocket server with periodic notification testing |
| packages/backend/vitest.config.ts | Configures test environment with path aliases and NODE_ENV |
| packages/backend/tsconfig.json | Adds typia transformer plugin and enables strict null checks |
| packages/backend/package.json | Adds WebSocket and typia dependencies with ts-patch setup script |
| docker-compose.local.yml | Exposes WebSocket port for development |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| import { Don, DonStateMessage, RequestNotificationMessage } from './messages'; | ||
| import { typiaValidationErrorMessage } from '@/utils/errorMessage'; | ||
|
|
||
| interface DonChannel { |
There was a problem hiding this comment.
The DonChannel interface should be exported to allow other modules to import and use it for dependency injection or testing purposes.
| interface DonChannel { | |
| export interface DonChannel { |
dc6de98 to
30f33b2
Compare
b7848c7 to
a126195
Compare
バックエンド側にWebsocket関連のインターフェイスになるサービスを生やしました。
やったこと
WebSocketDonChannelとWebSocketOrderChannelクラスの実装AsyncAPIのチャンネルの概念に合わせて、donChannelとorderChannelでそれぞれ別のサービスとして実装しました。
API specでdonと記載があるOperationはdonChannelが、orderと記載のあるOperationはorderChannelが扱う形です。
インターフェイスもAsyncAPI仕様に合わせていて、サーバー側からメッセージ送信するアクションをそのまま公開メソッドにしている感じです。
テストの実装
loggerの機能追加
一応手元のWebsocketクライアントでサーバー起動して叩ける確認はしてます
やってないこと