We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi @walkor
How to make the HTTP response of Workerman HTTP server waits from the HTTP client to finish first? 🤔
<?php use Workerman\Worker; require_once __DIR__ . '/vendor/autoload.php'; $http_worker = new Worker('http://127.0.0.1:2345'); $http_client = new Workerman\Http\Client(); $http_worker->count = 1; $http_worker->onMessage = function ($connection, $request) use ($http_client) { $http_client->request('https://ifconfig.me/ip', [ 'method' => 'GET', 'version' => '1.1', 'success' => function ($response) use ($connection) { echo $response->getBody() . "\n"; }, 'error' => function ($exception) { echo $exception; } ]); $connection->send(""); // need to use $response->getBody() here }; Worker::runAll();
The text was updated successfully, but these errors were encountered:
@walkor anyluck here ? :)
Sorry, something went wrong.
$http_worker->onMessage = function ($connection, $request) use ($http_client) { $http_client->request('https://ifconfig.me/ip', [ 'method' => 'GET', 'version' => '1.1', 'success' => function ($response) use ($connection) { $connection->send((string) $response->getBody()); }, 'error' => function ($exception) use ($connection) { $connection->send((string) $exception); } ]); };
Thanks @walkor 👍
No branches or pull requests
Hi @walkor
How to make the HTTP response of Workerman HTTP server waits from the HTTP client to finish first? 🤔
The text was updated successfully, but these errors were encountered: