websockets: add default values for client data

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-04-06 11:03:24 -04:00
parent b296444091
commit 3a21e9d6f0
No known key found for this signature in database
GPG Key ID: 7027245FBBDDF59A
1 changed files with 7 additions and 2 deletions

View File

@ -38,7 +38,7 @@ if TYPE_CHECKING:
RPCCallback = Callable[..., Coroutine]
AuthComp = Optional[components.authorization.Authorization]
CLIENT_TYPES = ["web", "mobile", "desktop", "display", "bot", "other"]
CLIENT_TYPES = ["web", "mobile", "desktop", "display", "bot", "agent", "other"]
SENTINEL = SentinelClass.get_instance()
class Subscribable:
@ -452,7 +452,12 @@ class WebSocket(WebSocketHandler, Subscribable):
self.message_buf: List[Union[str, Dict[str, Any]]] = []
self.last_pong_time: float = self.event_loop.get_loop_time()
self._connected_time: float = 0.
self._client_data: Dict[str, str] = {}
self._client_data: Dict[str, str] = {
"name": "unknown",
"version": "",
"type": "",
"url": ""
}
@property
def uid(self) -> int: