Skip to content

HttpServer promise cancellation #443

Closed
@bileslav

Description

@bileslav

Hi there,

I know that HttpServer cancels the promise returned to it if the connection is closed prematurely.

My app streams large files using Browser, so logically this is very useful for me,
but here comes the difficulty when using react/async, since there's no cancellation.

It's quite hard for me to change the flow to make it work (it would be a mixture of async/await and promises), nevertheless,
there's such a possibility. Should I take care of this? Or will streaming be terminated when the connection is closed anyway?

I tried to make artificial test, but I didn't succeed to understand.
Here's a super simplified example of how it's done for me now:

$responder = function (ServerRequestInterface $request) use ($browser): ResponseInterface {
	return await($browser->requestStreaming('GET', '...'));
};

$server = new HttpServer(async($responder));

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