Skip to content

unexpected stream closing #533

@unglaublicherdude

Description

@unglaublicherdude

Hi, I already opened a Discussion here, because I am not sure if this is a bug or expected behavious.

You can find the example code in our repository. Basically what I am confused about, is this line becuase after a http-request with a second Browser instance (yes I know, they share the same Loop) the stream from request 1 is closed without me doing anything with it.

        $browser1 = new Browser();
        $browser2 = new Browser();

        $response1 = await($browser1->requestStreaming("GET", "https://secure.eicar.org/eicar.com.txt"));
        $body1 = $response1->getBody();
        $this->assertEquals(true, $body1->isReadable());

        $response2 = await($browser2->requestStreaming("GET", "https://secure.eicar.org/eicar.com.txt"));
        $this->assertEquals(false, $body1->isReadable());
        $body2 = $response2->getBody();
        $this->assertEquals(true, $body2->isReadable());

Is there any way we can prevent that besides just doing a pause() and resume()? That SDK is currently build, so that customers create and provide the stream to our ForStream function, so we don't have that in our hands yet.

If there is now other way, my Idea would be to Wrap provide our own implementation from the ReadableStreamInterface enforcing the a pause on __construct and resume when actually doing something with it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions