fix(chat): isolate concurrent session events by refactoring WebSocket event handling (#365)
Refactored the WebSocket event handling mechanism to use global listeners with session-specific event routing instead of per-session listeners. This prevents event cross-talk when multiple chat sessions run concurrently. Key changes: - Client: Added sessionEventHandlers Map to route events to appropriate sessions - Client: Registered global listeners once per socket connection - Server: Extracted message processing logic into handleMessage method - Server: Improved Hermes session ID tracking with dedicated Map - Server: Added replaceByHermesSessionId for targeted message replacement Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -421,6 +421,7 @@ export function updateSessionStats(id: string): void {
|
||||
last_active = COALESCE((SELECT MAX(timestamp) FROM ${MESSAGES_TABLE} WHERE session_id = ?), started_at)
|
||||
WHERE id = ?`,
|
||||
).run(id, id, id)
|
||||
console.log(`Updated session ${id} stats`)
|
||||
}
|
||||
|
||||
export function getSessionDetailPaginated(
|
||||
|
||||
Reference in New Issue
Block a user