Move help to JSON and add server docstrings
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
"""Client connection model used by the signaling server."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
@@ -7,6 +9,8 @@ from websockets.asyncio.server import ServerConnection
|
||||
|
||||
@dataclass
|
||||
class ClientConnection:
|
||||
"""Represents one connected websocket client and its world state."""
|
||||
|
||||
websocket: ServerConnection
|
||||
id: str
|
||||
nickname: str = "user..."
|
||||
@@ -14,4 +18,6 @@ class ClientConnection:
|
||||
y: int = 20
|
||||
|
||||
def summary(self) -> dict[str, str | int]:
|
||||
"""Return a compact serializable snapshot for logs/diagnostics."""
|
||||
|
||||
return {"id": self.id, "nickname": self.nickname, "x": self.x, "y": self.y}
|
||||
|
||||
Reference in New Issue
Block a user