Describe connections method was fixed

This commit is contained in:
2023-04-19 11:51:52 +02:00
parent 6ef15c5e9d
commit 18b95fa62f

View File

@@ -57,8 +57,10 @@ class Routes():
await broadcast(websocket, self.__get_event(name, "deleted", entity_id )) await broadcast(websocket, self.__get_event(name, "deleted", entity_id ))
async def _describe(self, websocket, event): async def _describe(self, websocket, event):
connections = list(self.__connections) data = {}
data = { c.user["id"]: connections.count(c) for c in connections } for connection in self.__connections:
user_id = connection.user["id"]
data[user_id] = data[user_id] + 1 if user_id in data else 1
await websocket.send(json.dumps(self.__get_event("connections", "described", data))) await websocket.send(json.dumps(self.__get_event("connections", "described", data)))
async def _broadcast(self, _, event): async def _broadcast(self, _, event):