-
Notifications
You must be signed in to change notification settings - Fork 50
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
Add HTTP client #55
base: noetic-devel
Are you sure you want to change the base?
Add HTTP client #55
Conversation
I have to analyze this in detail but I think it would be nice to add this functionality. |
This PR cannot be accepted in the state it is right now, one main reason (among others):
I guess we could integrate this concept if it was part of one of the client_packages. |
@pabloinigoblasco That's a fair point and its bothered me as well tbh. I've been thinking of rewriting this client using the Boost.Beast module instead, which should be available on your repos if you can install ROS Noetic. The reason I didn't use it from the start is that we're using Ubuntu 18.04, which is stuck on Boost v1.65 and I think the Beast module was only added the Boost libraries in v1.68 and is available on Ubuntu 20.04, and will therefore only be available for Noetic. We were working on Melodic and are migrating to Noetic now, hence me only recently coming across Beast. Would this be a better way forward? I do think a web client would be useful in SMACC to allow communication with remote machines through standard web requests or sockets, I guess the question is just how that should be implemented |
using Boost.Beast sounds good. Besides that refactoring to Boot.Beast
From my side, we can go forward with this work. |
I agree that this would be a valuable addition to the client library, with numerous use cases. I also like the idea of developing it in noetic. We plan on making noetic the master branch quite soon (currently melodic). |
@pabloinigoblasco Fair points. I'll start porting it over as soon as I have some spare time and we've fully completed our migration to Noetic |
…d receive the responses as callbacks accessable by client behaviors
e4b01eb
to
f6a7521
Compare
additional error handling and callback management
I've made a client base that to make asynchronous HTTP requests. It follows the same principle as the ROS subscriber client, where a callback function is made available to client behaviours and is assigned to receive the HTTP response for processing. Only HTTP GET and POST requests are included right now, but its trivial to add others.
Note that the client base is dependent on the CPR library (C++ Requests, a high-level wrapper around libcurl). I've added an example which showcases the functionality and how the dependency can be resolved (
sm_atomic_http
). The CPR devs enabled CMake's FetchContent API so its quite portable and easy to integrate.I understand this opens up the question of which dependencies to include in the SMACC library and how they should be handled. Using raw CURL will be more portable, but I found it quite hard to work with. CPR presented me a good balance of usability and portability. However, I'm open to suggestions for alternative approaches.
┆Issue is synchronized with this Jira Task by Unito
┆Link To Issue: https://robosoft-ai.atlassian.net/browse/SMACC1-5