|
1 | 1 | # CHANGELOG |
| 2 | +## Version 0.61.3 (March 2026) |
| 3 | + |
| 4 | +**Released**: March 18, 2026 |
| 5 | + |
| 6 | +This release hardens the WebSocket client with improved thread-safety, bounded message queues, and better error handling. |
| 7 | + |
| 8 | +--- |
| 9 | + |
| 10 | +### 1. NEW FEATURES |
| 11 | + |
| 12 | +#### **Bounded Message Queue (`queue_maxsize`)** |
| 13 | +The `_MistWebsocket` client now supports a `queue_maxsize` parameter to limit the internal message buffer size. When set, incoming messages are dropped with a warning when the queue is full, preventing unbounded memory growth on high-frequency streams. |
| 14 | + |
| 15 | +```python |
| 16 | +ws = mistapi.websockets.sites.DeviceStatsEvents( |
| 17 | + apisession, |
| 18 | + site_ids=["<site_id>"], |
| 19 | + queue_maxsize=1000 # Limit buffer to 1000 messages |
| 20 | +) |
| 21 | +``` |
| 22 | + |
| 23 | +--- |
| 24 | + |
| 25 | +### 2. IMPROVEMENTS |
| 26 | + |
| 27 | +#### **Thread-Safety Enhancements** |
| 28 | +- Added `threading.Lock()` to protect shared state during concurrent access |
| 29 | +- Added `_finished` event for cleaner lifecycle management and proper shutdown signaling |
| 30 | + |
| 31 | +#### **Error Handling Hardening** |
| 32 | +- User-provided callbacks (`on_open`, `on_message`, `on_error`, `on_close`) are now wrapped in try/except blocks to prevent exceptions from crashing the WebSocket thread |
| 33 | +- Added warning when `cloud_uri` does not start with `"api."` (WebSocket URL may be incorrect) |
| 34 | + |
| 35 | +#### **Security: Header Redaction** |
| 36 | +- Added `_HeaderRedactFilter` to automatically redact `Authorization` and `Cookie` headers from `websocket-client` debug logs |
| 37 | + |
| 38 | +--- |
| 39 | + |
| 40 | +### 3. API CHANGES |
| 41 | + |
| 42 | +#### **Insights API** |
| 43 | +Added optional `port_id` query parameter to the following functions for port-level filtering: |
| 44 | +- **`getSiteInsightMetricsForDevice()`** |
| 45 | +- **`getSiteInsightMetricsForGateway()`** |
| 46 | +- **`getSiteInsightMetricsForMxEdge()`** |
| 47 | +- **`getSiteInsightMetricsForSwitch()`** |
| 48 | + |
| 49 | +--- |
| 50 | + |
2 | 51 | ## Version 0.61.2 (March 2026) |
3 | 52 |
|
4 | 53 | **Released**: March 17, 2026 |
|
0 commit comments