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!

Last Post!

irresponsible

irresponsible

I don’t understand what you mean about copying back and forth, but whatever the problem, I do know git submodules are never quite the answer I was looking for.

I’m not totally wedded to the monorepo if it makes using bricks difficult, but I don’t want any replacement to be significantly more effort.

Where Next?

Popular in Announcing Top

Crowdhailer
Experimenting with this code. OK.try do user <- fetch_user(1) cart <- fetch_cart(1) order = checkout(cart, user) save_orde...
New
mischov
import Meeseeks.CSS html = HTTPoison.get!("https://news.ycombinator.com/").body for story <- Meeseeks.all(html, css("tr.athing")) do...
New
treble37
Just looking for a little feedback on a tiny helper library I built - Sometimes I find the need to convert maps with atom keys to maps w...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 30338 241
New
sasajuric
I’d like to announce a small library called boundaries. This is an experimental project which explores the idea of enforcing boundaries ...
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
restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub. Docs are at OpenaiEx User Gu...
152 10719 134
New

Other popular topics Top

Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

We're in Beta

About us Mission Statement