Skip to content

[http] Link between Connection layer and Request handler #414

@quazardous

Description

@quazardous

Hi,

I'm using this kind of code to handle connection timeouts

$loop = React\EventLoop\Factory::create();

$socket = new React\Socket\Server($loop);
$socket->on('connection', function ($conn) use ($loop) {
    $func = function () use ($conn) {$conn->close();};
    $timer = $loop->addTimer(1, $func);
    $conn->on('data', function ($data) use ($loop, &$timer, $func) {
       $timer->cancel();
       $timer = $loop->addTimer(1, $func);
    });
});

It's working OK. But for some GET request with long results (search) I've to cancel the timer from the request handler (because it timeouts).

But I don't know how to connect the two worlds...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions