⚗️ add ws connection hook

This commit is contained in:
yanyongyu
2020-12-28 13:36:00 +08:00
parent 2d63eb32e1
commit c993f15bca
3 changed files with 92 additions and 5 deletions

View File

@ -188,7 +188,7 @@ class Driver(BaseDriver):
bot = BotClass(self, "websocket", self.config, x_self_id, websocket=ws)
await ws.accept()
self._clients[x_self_id] = bot
await self.bot_connect(bot)
logger.opt(colors=True).info(
f"WebSocket Connection from <y>{adapter.upper()} "
f"Bot {x_self_id}</y> Accepted!")
@ -202,7 +202,7 @@ class Driver(BaseDriver):
asyncio.create_task(bot.handle_message(data))
finally:
del self._clients[x_self_id]
await self.bot_disconnect(bot)
class WebSocket(BaseWebSocket):