@@ -41,6 +41,7 @@ This project provides a *simple* API for invoking *async* RPCs to remote web ser
41
41
* [ Functions] ( #functions )
42
42
* [ Promises] ( #promises )
43
43
* [ Cancellation] ( #cancellation )
44
+ * [ Timeouts] ( #timeouts )
44
45
* [ Install] ( #install )
45
46
* [ Tests] ( #tests )
46
47
* [ License] ( #license )
@@ -325,6 +326,43 @@ $loop->addTimer(2.0, function () use ($promise) {
325
326
});
326
327
```
327
328
329
+ #### Timeouts
330
+
331
+ This library uses a very efficient HTTP implementation, so most SOAP requests
332
+ should usually be completed in mere milliseconds. However, when sending SOAP
333
+ requests over an unreliable network (the internet), there are a number of things
334
+ that can go wrong and may cause the request to fail after a time. As such,
335
+ timeouts are handled by the underlying HTTP library and this library respects
336
+ PHP ' s `default_socket_timeout` setting (default 60s) as a timeout for sending the
337
+ outgoing SOAP request and waiting for a successful response and will otherwise
338
+ cancel the pending request and reject its value with an Exception.
339
+
340
+ Note that this timeout value covers creating the underlying transport connection,
341
+ sending the SOAP request, waiting for the remote service to process the request
342
+ and receiving the full SOAP response. To pass a custom timeout value, you can
343
+ assign the underlying [`timeout` option](https://github.com/clue/reactphp-buzz#timeouts)
344
+ like this:
345
+
346
+ ```php
347
+ $browser = new Browser($loop);
348
+ $browser = $browser->withOptions(array(
349
+ ' timeout ' => 10.0
350
+ ));
351
+
352
+ $client = new Client($browser, $wsdl);
353
+ $proxy = new Proxy($client);
354
+
355
+ $proxy->demo()->then(function ($response) {
356
+ // response received within 10 seconds maximum
357
+ var_dump($response);
358
+ });
359
+ ```
360
+
361
+ Similarly, you can use a negative timeout value to not apply a timeout at all
362
+ or use a `null` value to restore the default handling. Note that the underlying
363
+ connection may still impose a different timeout value. See also the underlying
364
+ [`timeout` option](https://github.com/clue/reactphp-buzz#timeouts) for more details.
365
+
328
366
## Install
329
367
330
368
The recommended way to install this library is [through Composer](https://getcomposer.org).
0 commit comments