Skip to content

Commit d8455dd

Browse files
committed
a
1 parent 90529c3 commit d8455dd

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

ProjectVG.Api/Middleware/WebSocketMiddleware.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,17 @@ await socket.SendAsync(
176176
_logger.LogWarning("WebSocket 세션 타임아웃: {UserId}", userId);
177177
}
178178
catch (WebSocketException ex) {
179-
_logger.LogWarning(ex, "WebSocket 연결 오류: {UserId}", userId);
179+
// 클라이언트가 적절한 close handshake 없이 연결을 종료한 경우 (일반적인 상황)
180+
if (ex.Message.Contains("closed the WebSocket connection without completing the close handshake") ||
181+
ex.Message.Contains("connection was aborted"))
182+
{
183+
_logger.LogInformation("클라이언트가 연결을 종료했습니다: {UserId}", userId);
184+
}
185+
else
186+
{
187+
// 기타 WebSocket 오류는 Warning으로 처리
188+
_logger.LogWarning(ex, "WebSocket 연결 오류: {UserId}", userId);
189+
}
180190
}
181191
catch (Exception ex) {
182192
_logger.LogError(ex, "세션 루프 예상치 못한 오류: {UserId}", userId);

ProjectVG.Application/Services/Session/ConnectionRegistry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void Unregister(string userId)
3333
}
3434
else
3535
{
36-
_logger.LogWarning("해제 대상 세션을 찾을 수 없음: {UserId}", userId);
36+
_logger.LogDebug("해제 대상 세션을 찾을 수 없음: {UserId}", userId);
3737
}
3838
}
3939

docs/architecture/chat-system-flow.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,15 @@ private async Task ProcessChatRequestInternalAsync(ChatProcessContext context)
6262
Unity Client ──WebSocket(/ws)──→ WebSocketMiddleware ──→ JWT 검증 ──→ 연결 등록
6363
│ InvokeAsync:31 │
6464
│ │
65-
└──Query Parameter: ?token={jwt} 또는 Authorization Header───────┘
65+
└──Query Parameter: ?token={jwt} 또는 Authorization Header─────────
6666
6767
┌───────▼───────┐
6868
│ 1. JWT 검증 │
69-
│ 2. 기존 연결 │
69+
│ 2. 기존 연결
7070
│ 정리 │
7171
│ 3. 새 연결 │
7272
│ 등록 │
73-
│ 4. 세션 루프 │
73+
│ 4. 세션 루프
7474
│ 시작 │
7575
└───────────────┘
7676
```

0 commit comments

Comments
 (0)