-
-
Notifications
You must be signed in to change notification settings - Fork 722
New issue
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
异步http请求? #255
Comments
Title: Asynchronous http request? Hello, thanks for open source, I learned a lot. There is currently a thorny problem. My program receives external input. Each input corresponds to an http request. The server response is relatively slow. Synchronous requests will cause the program io to block for 500ms. There may be other requests to process during these 500ms. Or other operations need to be performed, so I hope that the http request operation is asynchronous. Asynchronous means that I hope that my http request function can return immediately. When the http request returns data (json will be returned after 500ms), the returned json data will be processed through the pre-registered callback. The desired function signature is this:
There has been some research before, but the coding power is insufficient and has not been solved. It should be implemented using coroutines + http network operations. I wonder if you can give me some guidance? grateful ps. Pay more attention to performance and speed |
Then use coroutine https://github.com/tboox/tbox/blob/master/src/demo/coroutine/stream.c |
你好,感谢开源,学习到很多。
目前有一个棘手的问题,就是我的程序,接收外部输入,每一次输入,对应一次http请求,服务器响应比较慢,同步的请求会使得程序io阻塞500ms,这500ms中可能有其他请求要处理,或者是需要进行其他操作,所以我希望http请求的操作是异步的。
异步的意思是我希望我的http请求函数可以立刻返回,在http请求返回数据的时候(500ms之后会返回json),通过事先注册的回调处理返回的json数据。
希望的函数签名是这样:
之前有过一些调研,奈何码力不足,一直没有解决,应该是要使用协程 + http网络操作实现,不知道可否给予一些指导?感谢
ps. 比较注重性能和速度
The text was updated successfully, but these errors were encountered: