Open treck opened 1 year ago
I found a working solution myself, but would like to know if there are easier solutions.
$loop = $this->loop;
return new Promise(function (callable $resolve, callable $reject, callable $notify) use ($loop) {
// $loop->futureTick(... is needed, cause resolver is executed immediately
$loop->futureTick(function() use ($resolve, $notify) {
for ($x=0;$x<5;$x++) {
$notify([$x, 'Progress No. ' . $x, rand(0,9999)]);
await(\React\Promise\Timer\sleep(0.001)); // without this StreamData doesn't get sent
sleep(2); // some blocking actions
}
$resolve(['Done']);
});
});
Hi.
I would like to work with progressive Results on RPC as the data amount is bigger as usual and the client can still process some minor datasets, but i didn't found a working example.
I would love to see some working progressive Call-Result with Thruway, if someone has one.
Regards, Oliver