-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
InputStream throttling #36
Comments
You can't know whether a stream closed without reading from it. You can throttle a stream by just not immediately keeping to |
@kelunik why not to use Emitter, I think it will be more clear when stream is closed or there is some exceptions/errors ? |
@umbri Then it's the emitter that needs to read. You're free to use another stream abstraction such as ReactPHP's implementation, that's completely compatible. We don't like callbacks, that's why we have a callback-free API for streams. |
@kelunik Roger that! Thanks |
Typically I read from stream like this
while (($data = yield $stream->read()) !== null)
and if I have readednull
stream is closed.How can I know/find that stream is closed without read from it ?
How can I throttle stream ?
P.S: I want to implement something like
pause()
,resume()
that will permit throttling, very useful for testingThe text was updated successfully, but these errors were encountered: