-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Websockets v2 iterator #3067
Merged
Merged
Websockets v2 iterator #3067
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- AsyncIterator support: Add ``__aiter__()`` method to ``_PersistentConnectionWeb3`` in order to support infinite websocket connections.
- If we don't care about latency, we should just use an unsolicited pong for the heartbeat: https://websockets.readthedocs.io/en/stable/reference/asyncio/client.html#websockets.client.WebSocketClientProtocol.pong - Add a max for connection retries, set a default, and add an exponential backoff rate when attempting to connect.
- Separate the goethereum_ws_v2 tests into a directory with ``AsyncGenerator`` / "async with w3..." style tests and ``AsyncIterator`` / "async for w3..." style tests
fselmo
force-pushed
the
websockets-v2-iterator
branch
from
July 28, 2023 22:19
cc35b3c
to
ca8985f
Compare
fselmo
force-pushed
the
websockets-v2-iterator
branch
from
July 28, 2023 23:27
534597f
to
311b706
Compare
- Due to the exponential backoff, it is already pretty reasonable to have this number at 5 but more than this might add long wait times. If there is demand, we can open this up to an init arg in the future.
fselmo
force-pushed
the
websockets-v2-iterator
branch
from
July 28, 2023 23:36
311b706
to
9fdd4ec
Compare
kclowes
approved these changes
Jul 31, 2023
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.
LGTM! 🚢
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Summary:
AsyncWeb3
withWebsocketProviderV2
viapersistent_connection()
WebsocketProviderV2
tests into asynchronous generator / context manager (async with) and asynchronous iterator (async for) testsPeripheral changes:
WebsocketProviderV2
. Keep re-connection attempts reasonable at5
for now.is_connected()
method for wsV2, as recommended by thewebsockets
library, use the unsolicited pong call.Todo:
Cute Animal Picture