You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 0.61.2
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* propagate ws reconnect to other classes
* bug fixes and other improvements
* update tests
* bug fixes
---------
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
-`max_reconnect_attempts` — Maximum reconnect attempts before giving up (default: `5`)
16
+
-`reconnect_backoff` — Base backoff delay in seconds, with exponential increase (default: `2.0`)
17
+
18
+
When enabled, the WebSocket automatically reconnects on transient failures using exponential backoff. User-initiated `disconnect()` calls are respected during reconnection attempts.
19
+
20
+
```python
21
+
ws = mistapi.websockets.sites.DeviceStatsEvents(
22
+
apisession,
23
+
site_ids=["<site_id>"],
24
+
auto_reconnect=True,
25
+
max_reconnect_attempts=5,
26
+
reconnect_backoff=2.0
27
+
)
28
+
ws.connect(run_in_background=True)
29
+
```
30
+
31
+
---
32
+
33
+
### 2. API CHANGES (OpenAPI 2602.1.7)
34
+
35
+
Updated to mist_openapi spec version 2602.1.7.
36
+
37
+
#### **Insights API**
38
+
-**`getSiteInsightMetrics()`** — Now uses `metrics` as a query parameter instead of a path parameter
39
+
-**`getSiteInsightMetricsForAP()`** — New function to retrieve insight metrics for a specific AP
40
+
-**`getSiteInsightMetricsForClient()`** — Changed `metric` path parameter to `metrics` query parameter
41
+
-**`getSiteInsightMetricsForGateway()`** — Changed `metric` path parameter to `metrics` query parameter
- Fixed `ShellSession.recv()` to gracefully handle socket timeout reset when the connection is already closed
51
+
- Fixed thread-safety (TOCTOU) race conditions in `ShellSession` by capturing WebSocket reference in local variables across `disconnect()`, `connected`, `send()`, `recv()`, and `resize()` methods
52
+
- Fixed thread-safety race condition in `_MistWebsocket.disconnect()` with local variable capture
Copy file name to clipboardExpand all lines: README.md
+7-3Lines changed: 7 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -579,19 +579,23 @@ The package provides a WebSocket client for real-time event streaming from the M
579
579
580
580
### Connection Parameters
581
581
582
-
All channel classes accept the following optional keyword arguments to control the WebSocket keep-alive behaviour:
582
+
All channel classes accept the following optional keyword arguments:
583
583
584
584
| Parameter | Type | Default | Description |
585
585
|-----------|------|---------|-------------|
586
586
|`ping_interval`|`int`|`30`| Seconds between automatic ping frames. Set to `0` to disable pings. |
587
587
|`ping_timeout`|`int`|`10`| Seconds to wait for a pong response before treating the connection as dead. |
588
+
|`auto_reconnect`|`bool`|`False`| Automatically reconnect on transient failures using exponential backoff. |
589
+
|`max_reconnect_attempts`|`int`|`5`| Maximum number of reconnect attempts before giving up. |
590
+
|`reconnect_backoff`|`float`|`2.0`| Base backoff delay in seconds. Doubles after each failed attempt (2s, 4s, 8s, ...). Resets on successful reconnection. |
588
591
589
592
```python
590
593
ws = mistapi.websockets.sites.DeviceStatsEvents(
591
594
apisession,
592
595
site_ids=["<site_id>"],
593
-
ping_interval=60, # ping every 60 s
594
-
ping_timeout=20, # wait up to 20 s for pong
596
+
ping_interval=60, # ping every 60 s
597
+
ping_timeout=20, # wait up to 20 s for pong
598
+
auto_reconnect=True, # reconnect on transient failures
0 commit comments