1/14/2024 0 Comments Elixir ibrowsesleep / 1 sleep ( time ) :: :ok when Time: timeout (), time: var Documentation is not available for non - Elixir modules. ![]() In Elixir, we have common way to call functions, that looks something like: In terms of Erlang and Elixir, the meaning of this statement is: This library makes my coding experience smoother Wrapper brings additional functionality.Wrapper makes the using experience smoother.This question have several possible answers: Why should I wrap Erlang library into Elixir library, when I can call it directly? simplehttp (you’ve never heard about it, yeah?) - based only on httpcĪfter getting this information, one should ask himself:.Tesla - has adapters for both Hackney and IBrowse, and even to httpc.HTTPoison - is based on Hackney, and inspired by….I don’t want to disappoint you, but there is no famous Elixir HTTP client.Īll Elixir’s HTTP client packages are just wrappers for Erlang written Really… But these two should be enough! What about pure Elixir implementations? I don’t need to think about HTTP client’s security.I have 5 time bigger chance to have it already installed in my project’s deps.But, as for me, I’ll choose Hackney for these reason: Hackney’s last release was 1 day ago versus IBrowse’s previous year release (don’t blame me for falsifications with this article’s posting time :) )īoth IBrowse and Hackeny are great instruments to make good HTTP communication for your application.Binary strings with Unicode support, which is more common in Elixir, against charlists, that are more common in Erlang world.Secondary parametersįairly saying, Hackney has some secondary advantages: So, from security point of view, Hackney looks the most considered. you should create additional amount of code by yourself to implement this.There is great article about security, and no sense to say something more.Ĭonclusion: Only Hackney validates SSL by dafault, using certifi library, but you can use this library in every other HTTP client. We should be sure, that our requests goes to right domains, can’t be penetrated, nobody can steal our tokens and keys. The second (and sometimes - the first) parameter - security. But they show, that there is almost no difference between our libraries.Ĭonclusion: they both performs almost the same. You can find rewritten into Elixir code in this repo. We can fix these test with all modern versions of these libraries. Unfortunately, the repo’s last commit was mad 3 years ago. Which has some information about performance comparison of main HTTP clients. ![]() I’ve found interesting repo - httpcbench, Everybody loves benchmarks (even if they don’t know what to do with them)! The main thing, that is important for developer - library performance. That’s why, lets try to compare a bit our gigant! Performance This quality comes from common cookbooks, solutions, documentation and issues on Github, and answered questions on StackOverflow. We’ll not cover small libraries in this article, and probably in our projects because of simple open source law: In Hex registry we can find some good examples of HTTP client alternatives.Īll of them have almost the same user experience and differs in bench of small and very useful features. So, great developers created there own HTTP clients, and shared them into open source. HTTPC alternativesĪs we know now, HTTPC has one big benefit - it’s included into OTP, and a lot of limitation. May be they know something, that I don’t know.īut this is a good example of a place in code, where you can think about what to do - get side package with bench of dependencies, or use Erlang’s batteries, because it’s just enough. What do you think, can you fetch one small file in a single day, usingįairly saying, I don’t know why tzdata maintainers are using Hackneyįor this task. ensure_all_started ( :ssl ) # Now we can make request: end ensure_all_started ( :inets ) # We should start `ssl` application also, # if we want to make secure requests: Application. # First, we should start `inets` application.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |