irresponsible

irresponsible

Bricks - the sockets suite of your dreams

Bricks is a new suite of sockets libraries which will ultimately grow to encompass:

  • TCP/SSL/Unix sockets
  • Connector and acceptor pools
  • HTTP client and server
  • and more!

The name is a hint at the philosophy of the library - that it should be possible to plug things together to solve your problem. The bricks suite came about because no existing http client was flexible enough to handle a particularly badly behaved web api I needed to integrate with. It should be flexible enough for you to integrate with your own particularly badly behaved network services.

github
hexdocs

Here is the intro to bricks, the first library in the suite:

The OTP gen_tcp and ssl libraries have quite a few pain points:

  • A different (albeit identical) API per socket type
  • Different active mode message tags per socket type
  • Risk of mailbox overflow-induced BEAM crash in active mode
  • ssl ignores your intended socket state options on handshake
  • gen_tcp sockets default to a different activity mode for a unix socket
  • Confusing documentation
  • Lack of useful examples

This library attempts to address these problems.

Goals:

  • Intuitive high-level API for common tasks
  • Simple low-level API for advanced purposes
  • Fully embrace active and passive socket modes, avoiding active overflow
  • Do not force a process model on the user
  • Examples of common use cases

Most Liked

NobbZ

NobbZ

Just use the :sparse option.

Why don’t you use git submodules then? As it is now, it looks as if it were even harder to maintain, by copying back and forth from your monorepo, but then again it feels weirtd not to have the regular flat hirarchy.

OvermindDL1

OvermindDL1

Well this looks cool. :slight_smile:

The repo is a bit odd looking though, the elixir project is in a subdirectory instead of the git root? That will make it hard to use with mix.exs as a github dependency (is it even possible?). I’d recommend putting the project at the git root so mix.exs can github depend on it directly if someone needs to test the master or a branch version or so.

Hmm, so bounded active with an integer is like active: one repeatedly until that integer number worth of packets is buffered (until drained)? That’s pretty cool.

I’ll need to play with it in some project sometime but the API looks immediately useful. :slight_smile:

irresponsible

irresponsible

The repo is like that because on my machine it’s actually a monorepo with four projects in it (of which i’ve only released one, the rest aren’t ready yet) with the root directory containing an umbrella project (so i can build combined docs for all the modules for convenience).

Integer bounded active is not quite like :once repeatedly - :once doesn’t cause a passive notification whereas an integer does. Note carefully the warning about the internal counter in the documentation - it’s confusing!

Where Next?

Popular in Libraries Top

scohen
Lexical Lexical is a next-generation language server for the Elixir programming language. Features Context aware code completion As-you...
New
zoltanszogyenyi
Hey everyone :wave: Excited to join this forum - I am one of the founders and current project maintainers of a popular and open-source U...
New
kevinlang
Hey all, We have made an Ecto3 Adapter for SQLite3, ecto_sqlite3! We have successfully on-boarded the full suite of integration tests (...
New
seancribbs
Today I released a new dialyzer Mix task as the dialyzex package! At the time we started writing this task, the existing dialyzer integra...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. Features Unstyled Phoenix components. Storybook that can be added to...
New
arkgil
Hi all! I’m happy to announce that Telemetry v0.3.0 is out! This release marks the conversion from Elixir to Erlang so that all the libr...
New
New
benlime
LiveMotion enables high performance animations declared on the server and run on the client. As a follow up to my previous thread A libr...
New
Crowdhailer
Experimenting with this code. OK.try do user <- fetch_user(1) cart <- fetch_cart(1) order = checkout(cart, user) save_or...
New
mplatts
With HEEX released we decided to start a components library using Tailwind CSS - check it out here: Petal Components. We also have a boi...
New

Other popular topics Top

yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 42633 214
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New

Sub Categories:

We're in Beta

About us Mission Statement