(self)
| 86 | return False |
| 87 | |
| 88 | async def close_all(self) -> None: |
| 89 | async with self._lock: |
| 90 | conns = [(uid, s) for uid, s in self._connections.items()] |
| 91 | self._connections.clear() |
| 92 | coros = [] |
| 93 | for uid, socks in conns: |
| 94 | for ws in socks: |
| 95 | try: |
| 96 | coros.append(ws[0].close()) |
| 97 | except Exception as e: |
| 98 | self.log.warning(f" WebSocket failed to close to {uid}: {e}") |
| 99 | if coros: |
| 100 | await asyncio.gather(*coros, return_exceptions=True) |
| 101 | self.log.info("🥝 WebSocket Closed all websockets") |