Closed alexsup closed 8 years ago
@alexsup
The issue is that you can only have one loop running at a time and since RxHttp uses a static loop you need to make sure that the scheduler and RxHttp use the same loop. You can do that two different ways. If you already have a loop you can set it as the static \EventLoop\setLoop($loop);
or you can use the static loop in the EventLoopScheduler. I've updated your example to show how to do that:
$users = [
"user_id_1",
"user_id_2",
];
$loop = \EventLoop\getLoop();
$scheduler = new Rx\Scheduler\EventLoopScheduler($loop);
$observable = \Rx\Observable::fromArray($users);
$selectManyObservable = $observable
->flatMap(function ($value) {
return \Rx\React\Http::get("http://www.google.com");
})
->timeout(5000);
$selectManyObservable->subscribe($createStdoutObserver(), $scheduler);
@davidwdan Thank you so much! All working now :)
Hello :)
When using RxHttp with ->timeout(), the timeout() behaves like a timer.
It simply hangs for the specific length of time in timeout() and then triggers the error state.
Here is example code:
Am I simply misunderstanding the use of timeout?
Thanks :)
AB