Skip to content

Commit

Permalink
change default event DataType
Browse files Browse the repository at this point in the history
  • Loading branch information
AAGaming00 authored Nov 10, 2023
1 parent f603c29 commit df9e2ac
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backend/src/wsrouter.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ async def handle(self, request: Request):
self.logger.debug('Websocket connection closed')
return ws

async def emit(self, event: str, data: DataType | None = None, data_type: Type[DataType] = Any):
# DataType defaults to None so that if a plugin opts in to strict pyright checking and attempts to pass data witbout specifying the type (or any), the type check fails
async def emit(self, event: str, data: DataType | None = None, data_type: Type[DataType] = None):
self.logger.debug('Firing frontend event %s with args %s', data)

await self.write({ "type": MessageType.EVENT.value, "event": event, "data": data })
await self.write({ "type": MessageType.EVENT.value, "event": event, "data": data })

0 comments on commit df9e2ac

Please sign in to comment.