Skip to content
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

Merged
merged 11 commits into from Feb 25, 2022
Merged

Conversation

bubbleboy14
Copy link
Collaborator

Two things:

  1. _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

  2. 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).

…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)
Copy link

@pssolanki111 pssolanki111 left a 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
Copy link

codecov bot commented Feb 25, 2022

Codecov Report

Merging #795 (85342a8) into master (d7aa5c9) will decrease coverage by 0.08%.
The diff coverage is 80.00%.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
websocket/_socket.py 55.55% <33.33%> (-0.93%) ⬇️
websocket/_app.py 81.18% <91.66%> (+0.39%) ⬆️
websocket/_utils.py 80.55% <0.00%> (-2.78%) ⬇️
websocket/_handshake.py 92.10% <0.00%> (+0.21%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e49e0e8...85342a8. Read the comment docs.

@engn33r engn33r merged commit f719d0a into websocket-client:master Feb 25, 2022
@engn33r
Copy link
Collaborator

engn33r commented Feb 25, 2022

Thanks for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants