Comments (5)
@puzza007 I honestly inspired myself from https://github.com/lpgauth/buoy . Difference is that in buoy you get on single message at the end of the response with the response. In hackney you get multiple messages progressively like: when you get the headers, when you get the body and one at the final... This makes most of the use cases complicated because you have to aggregate yourself everything and when the done response comes you know you have the response.
from katipo.
It's certainly possible. At the moment it uses https://erlang.org/doc/man/gen_server.html#reply-2 to make synchronous responses. Do you have an existing asynch API in mind?
from katipo.
I'm thinking that inside the request options to add:
async
= true| false (default isfalse
to work as it is now)reply_to
= any pid (default toself()
)
And when async = true
the katipo:req
to return {ok, ResponseReference::ref()}
Once the response is available the process indicated in reply_to
to receive a message like:
{katipo_resp, ResponseReference, Response}
where ResponseReference
to be the one you returned in the request and
Response
to be the HTTP call response:
#{status := 200,
headers := RespHeaders,
cookiejar := CookieJar,
body := RespBody}
or whatever katipo:req
returns normally when using sync calls.
What do you think ?
Silviu
from katipo.
Cool so basically something like https://github.com/benoitc/hackney#get-a-response-asynchronously 👍
from katipo.
Cool. I've started a branch with some very early work. I haven't got it running yet.
from katipo.
Related Issues (20)
- compilation fails on Elixir 1.11.2 / OTP 23 / rebar 3.13.1 HOT 5
- rebar.config.script is missing from latest hex.pm release HOT 2
- NTLM support? HOT 1
- Something broken after #112
- Wrong keys in Opts map in first example of README.md
- Last example in REAMDE.md
- To use katipo one needs to start erl with some dirty scheduler switch? HOT 2
- Migrate away from Travis CI
- Fix the self-signed tests
- fatal error: 'event.h' file not found on MacOS Ventura M1 Pro HOT 1
- Getting bad options when trying to fetch URL using proxy HOT 2
- How to disable HTTP/2 for GET queries HOT 2
- Publish 0.5.1 to hex.pm HOT 1
- CURLOPT_INTERFACE HOT 6
- Add links to curl docs from readme
- Replace use of docker in unix domain socket test with cowboy HOT 2
- Support DoH
- Travis CI uses an old version of rebar3
- better cowlib dependency? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from katipo.