With Guzzle, do promises provide any real utility? It seems that you must call wait(). The following code (from the docs) seems to do nothing by itself:
$promise = $client->requestAsync('GET', 'http://httpbin.org/get');
$promise->then(
function (ResponseInterface $res) {
echo $res->getStatusCode() . "\n";
},
function (RequestException $e) {
echo $e->getMessage() . "\n";
echo $e->getRequest()->getMethod();
}
);
If you must call $promise->wait() to make the request, what's the point of a promise? How is this really any different than:
$request = new Request('GET', 'http://httpbin.org/get');
$response = $client->send($request);
if ($response
Best I can tell, the only benefit is it's convenient approach to define the request success and failure callbacks. Even the doc section on making multiple requests has the code below, which appears to block and execute all requests... perhaps at the "same time". Is this all I should expect?
// Wait on all of the requests to complete.
$results = Promise\unwrap($promises);