Parallel requests #386
-
Hi, I was wondering how we could achieve parallelism. I assume that at a lower level this is possible to achieve with curl multi exec, but at the framework level do you have any hints as to how this could be achieved? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It is possible if you use ext-fibers (which will be in core starting from php 8.1). It can also be installed standalone on other php versions. Next, you'll need to create a custom fiber-based http handle. Here is a sample implementation: Note : this is code for version 2 of this soap-client. You'll need to use the old interfaces instead. Note 2 : this will not be parallel, but rather concurrent in a non-blocking way. However, it is based on httplug promises, which require a blocking wait() call at some point. You might be better of using amp http client or guzzle pools instead. |
Beta Was this translation helpful? Give feedback.
It is possible if you use ext-fibers (which will be in core starting from php 8.1). It can also be installed standalone on other php versions.
Next, you'll need to create a custom fiber-based http handle.
Here is a sample implementation:
https://github.com/php-soap/async-transport
Note : this is code for version 2 of this soap-client. You'll need to use the old interfaces instead.
Note 2 : this will not be parallel, but rather concurrent in a non-blocking way. However, it is based on httplug promises, which require a blocking wait() call at some point. You might be better of using amp http client or guzzle pools instead.