-
Notifications
You must be signed in to change notification settings - Fork 24
Closed
Description
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:
$connector->create('www.google.com', 80)->then(function (React\Stream\Stream $stream) {
$stream->write('...');
$stream->close();
});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:
$connector->create('www.google.com', 80)->then(function (Stream $stream) use ($template) {
$stream->write('…');
$stream->getBuffer()->on('full-drain', function() use($stream) {
$stream->close();
});
});Is this as simple as a doc update?
Metadata
Metadata
Assignees
Labels
No labels