Archived
Attempt to fix #12
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"""Handles communication between one WebSocket tunnel and the game"""
|
||||
|
||||
from typing import Callable, Any, TYPE_CHECKING
|
||||
from typing import Callable, Any, TYPE_CHECKING, Awaitable
|
||||
from pydantic import ValidationError
|
||||
|
||||
from websockets.server import WebSocketServerProtocol
|
||||
@@ -45,6 +45,8 @@ class ClientController:
|
||||
|
||||
track_connection: Callable
|
||||
|
||||
on_message = Callable[[Message], Awaitable[None]]
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
game_controller: "GameController",
|
||||
@@ -53,7 +55,10 @@ class ClientController:
|
||||
self.websocket = websocket
|
||||
self.game_controller = game_controller
|
||||
self.game_controller.clients.append(self)
|
||||
self.on_message = lambda _: None
|
||||
self.on_message = self.on_message_stub
|
||||
|
||||
async def on_message_stub(self, message: Message):
|
||||
pass
|
||||
|
||||
async def close(self):
|
||||
"""Remove self from Game broadcasting list"""
|
||||
|
||||
Reference in New Issue
Block a user