[ECO-5698] fix: handle normal WebSocket close frames and improve reconnection logic#672
[ECO-5698] fix: handle normal WebSocket close frames and improve reconnection logic#672
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughTransport now respects TLS when building WS URLs, cancels and resets idle timers instead of layering them, and treats a normal WebSocket read-loop exit as a clean close — disposing resources and deactivating the transport to allow immediate reconnection. Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@test/ably/realtime/realtimeconnection_test.py`:
- Around line 4-5: The test imports use a websockets 15+ path for the server
(from websockets.asyncio.server import serve as ws_serve) which breaks on
websockets 14; update the import to try the asyncio.server location first and
fall back to the 14-style location (import serve from websockets.server) using a
try/except ImportError pattern so that _ws_connect and ws_serve work across
versions—apply the same fallback pattern used in websockettransport.py to
replace the direct serve import.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5e88438e-621b-4a71-986c-a86504579c8f
📒 Files selected for processing (2)
ably/transport/websockettransport.pytest/ably/realtime/realtimeconnection_test.py
8627a99 to
97b9e25
Compare
…nnection logic - Added local WebSocket proxy for testing (`WsProxy`) and corresponding tests for immediate reconnection on normal close. - Fixed missing reconnection on server-sent normal WebSocket close frames in `WebSocketTransport`. - Adjusted idle timer handling to avoid accidental reuse.
97b9e25 to
69a7527
Compare
b249196 to
7cc7742
Compare
resolves #671
WsProxy) and corresponding tests for immediate reconnection on normal close.WebSocketTransport.Summary by CodeRabbit
Bug Fixes
Tests