You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From what I can see, the $stream->write() appends the data to the buffer and doesn't do a lot else at that point; it waits for the next tick of the event loop to come and write the buffer out. Because of that, when you follow it immediately with $stream->close(), it closes it and flushes the buffer.
As I said, I'm not sure if this is expected behaviour, and I can see benefits in both. As a work around, I'm doing this:
Yeah, that actually makes sense once reading the stream documentation. It all totally makes sense to function the way it does, so I guess just updating the example would be the best thing to do.
Hey, Not sure if this is desired behaviour or not, but I've run into an issue where the data in the buffer doesn't ever get written.
As per example:
From what I can see, the
$stream->write()
appends the data to the buffer and doesn't do a lot else at that point; it waits for the next tick of the event loop to come and write the buffer out. Because of that, when you follow it immediately with$stream->close()
, it closes it and flushes the buffer.As I said, I'm not sure if this is expected behaviour, and I can see benefits in both. As a work around, I'm doing this:
Is this as simple as a doc update?
The text was updated successfully, but these errors were encountered: