| 207 | return False, msg |
| 208 | |
| 209 | def _on_ws_close(self, ws, *args): |
| 210 | self.ws_client = None |
| 211 | self.is_connected = False |
| 212 | if self._suppress_auto_reconnect_once: |
| 213 | self._suppress_auto_reconnect_once = False |
| 214 | return |
| 215 | # Auto Reconnect |
| 216 | if not self.is_login_phase and not self.disconnected: |
| 217 | self.is_auto_reconnecting = True |
| 218 | if self.first_conn_lost: |
| 219 | self.notification_manager.notify( |
| 220 | title=f"{APP_NAME}: WebSocket Connection Lost ⛓️💥", |
| 221 | message="Check your internet connection. Retrying...", |
| 222 | ) |
| 223 | self.first_conn_lost = False |
| 224 | time.sleep(RECONNECT_WS_TIMER) # seconds |
| 225 | self.connect() |
| 226 | |
| 227 | def manual_reconnect(self): |
| 228 | if not self.is_auto_reconnecting: |