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

RLP StreamReader #148

Open
wjmelements opened this issue Oct 28, 2023 · 0 comments
Open

RLP StreamReader #148

wjmelements opened this issue Oct 28, 2023 · 0 comments

Comments

@wjmelements
Copy link

What feature should we add?

While messages from a stream might normally need delineation, the length prefix of RLP makes delimiters redundant. Also, no delimiter can be valid for RLP. I am requesting a way to read complete rlp-encoded messages from a stream (eg sys.stdin).

Essentially it should work similar to asyncio.StreamReader.readline() but read an entire RLP message rather than a utf-8 line.

Usage

reader = rlp.StreamReader()
pipe_protocol = asyncio.StreamReaderProtocol(reader)
loop = asyncio.get_event_loop()
await loop.connect_read_pipe(
    lambda: pipe_protocol, sys.stdin
)
message = await reader.read()
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

No branches or pull requests

1 participant