We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
async def ws_event(self): async with aiohttp.ClientSession() as session: while not self.closed: try: async with session.ws_connect(f"{self.baseurl}", headers=self.headers) as ws_connection: logger.info("Protocol: connected") while True: if self.closed or ws_connection.closed: break try: received_data = await ws_connection.receive_json(timeout=3) except: continue if received_data: post_type = received_data["post_type"] try: if post_type == "message": received_data = MessageTypes[received_data["message_type"]].parse_obj(received_data) elif post_type == "notice": received_data = NoticeTypes[received_data["notice_type"]].parse_obj(received_data) elif post_type == "request": received_data = RequestTypes[received_data["request_type"]].parse_obj(received_data) else: continue except KeyError: logger.error("Protocol: data parse error: " + str(received_data)) continue except pydantic.error_wrappers.ValidationError: logger.error("Protocol: data parse error: " + str(received_data)) continue await self.queue.put(InternalEvent( name=self.getEventCurrentName(type(received_data)), body=received_data )) logger.info("Protocol: disconnected") except Exception as e: logger.error(e) await asyncio.sleep(3)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: