saloonphp / saloon

🤠 Build beautiful API integrations and SDKs with Saloon
https://docs.saloon.dev
MIT License
2.06k stars 105 forks source link

async request with multi connector #414

Closed mstfblci closed 4 months ago

mstfblci commented 5 months ago

How exactly should I send requests asynchronously with multiple connectors?

Sammyjo20 commented 4 months ago

Hey @mstfblci I think you may be able to do something like this, you'll need to "hack" it slightly by providing a connector to create the pool but you'll be able to use sendAsync on all your other connectors.

$connectorA->pool()->setRequests([
     $connectorB->sendAsync($requestA),
     $connectorC->sendAsync($requestA),
     $connectorD->sendAsync($requestA),
])

Let me know if this doesn't work!