New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
custom dispatcher pings/timeouts #795
Conversation
…d except TimeoutError - raise WebSocketTimeoutException
…ent compatibility): WrappedDispatcher (for use with generic event dispatchers such as pyevent and rel); create_dispatcher() accepts dispatcher kwarg (default None), and if it is specified, returns a WrappedDispatcher; use create_dispatcher() (passing specified dispatcher if any) every time (regardless of dispatcher specification)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the changes sound good as discussed in #786
Codecov Report
@@ Coverage Diff @@
## master #795 +/- ##
==========================================
- Coverage 84.54% 84.45% -0.09%
==========================================
Files 13 13
Lines 1281 1293 +12
Branches 273 275 +2
==========================================
+ Hits 1083 1092 +9
- Misses 125 129 +4
+ Partials 73 72 -1
Continue to review full report at Codecov.
|
Thanks for the PR! |
Two things:
_socket.recv() error handling
a) fixed socket.error except logic (_socket.py line 95) - I believe the line substituted fulfills the intention of the three lines replaced
b) throw WebSocketTimeoutException on TimeoutError
custom dispatchers (_app.WrappedDispatcher)
a) fixes pyevent integration - calls read() w/ correct arguments
b) simplifies rel integration - no need for rel.safe_read()
c) supports ping_timeout/ping_interval via dispatcher.timeout() w/ check_callback(), if ping_timeout specified
So these changes should make the two modes (standard and w/ custom dispatcher) functionally equivalent in these ways. That is, if you decide to start or stop using a custom dispatcher, your ping_timeout/ping_interval handling won't change (check() function in _app is still called), and your application won't have to handle any new exceptions (such as TimeoutError, which is now expressed as WebSocketTimeoutException).