HTTP 客户端读取 SSE 数据
#5562
-
我的问题是使用协程版的 HTTP 客户端如何分批次读取 chunked/SSE 数据?看文档里没有相关的方法或示例: |
Beta Was this translation helpful? Give feedback.
Answered by
crystoy
Dec 26, 2024
Replies: 1 comment
-
可以使用 write_func 回调(swoole >= 5.1.0)来处理 HTTP CHUNK 数据 $cli = new Swoole\Coroutine\Http\Client('127.0.0.1', 80);
$cli->set(['write_func' => function ($client, $data) {
var_dump($data);
}]);
$cli->get('/'); https://wiki.swoole.com/zh-cn/#/coroutine_client/http_client?id=write_func |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
crystoy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
可以使用 write_func 回调(swoole >= 5.1.0)来处理 HTTP CHUNK 数据
https://wiki.swoole.com/zh-cn/#/coroutine_client/http_client?id=write_func