-
-
Notifications
You must be signed in to change notification settings - Fork 166
Closed
Labels
Description
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...