Pre-combat-improvements: Combat animations, flee fixes, corpse logic updates
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
WebSocket connection manager for real-time game updates.
|
||||
Handles WebSocket connections and Redis pub/sub for cross-worker communication.
|
||||
"""
|
||||
import uuid
|
||||
from typing import Dict, Optional, List
|
||||
from fastapi import WebSocket
|
||||
import logging
|
||||
@@ -86,9 +87,13 @@ class ConnectionManager:
|
||||
connections = self.active_connections[player_id]
|
||||
disconnected_sockets = []
|
||||
|
||||
# Inject unique message ID for tracing
|
||||
if "id" not in message:
|
||||
message["id"] = str(uuid.uuid4())
|
||||
|
||||
for websocket in connections:
|
||||
try:
|
||||
logger.debug(f"Sending {message.get('type')} to player {player_id}")
|
||||
logger.debug(f"Using WS: Sending msg {message['id']} type={message.get('type')} to player {player_id}")
|
||||
await websocket.send_json(message)
|
||||
except Exception as e:
|
||||
logger.error(f"Failed to send message to player {player_id}: {e}")
|
||||
|
||||
Reference in New Issue
Block a user