Commit 4a08100
Fix websocket "Cannot write to closing transport" error (#373)
Fixes #156
Prevent race condition where heartbeat ping attempts to send data
on a closing websocket connection:
- Add closed state check in _ping() before sending
- Wrap ping send in try/except to handle connection errors gracefully
- Cancel heartbeat callback when websocket closes or stops
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent e3edc08 commit 4a08100
1 file changed
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
72 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
73 | 78 | | |
74 | 79 | | |
75 | 80 | | |
| |||
146 | 151 | | |
147 | 152 | | |
148 | 153 | | |
| 154 | + | |
149 | 155 | | |
150 | 156 | | |
151 | 157 | | |
| |||
173 | 179 | | |
174 | 180 | | |
175 | 181 | | |
| 182 | + | |
176 | 183 | | |
177 | 184 | | |
178 | 185 | | |
| |||
0 commit comments