NobbZ

NobbZ

Abstraction for serverside connections

I’m currently doing some Client/Server stuff.

I’m in the early stage of development and do currently use gen_tcp on the server side directly, accepting connections in a single supervised Task which “loops” infinetly and does not have any means of shuting it down, except for a brutal kill.

Once a client connects, a GenServer is started under a DynamicSupervisor and ownership of the connection transfered to that GenServer.

In general this seems to work so far, but I have not even implemented handshaking (properly) and I already think, that GenServer was the wrong choice and that I should use a GenStatem perhaps?

But while looking into this I found that there is at least one client side library available that abstracts some connection and state handling away as far as I was able to see, so now my question is, is there some package available that abstracts manual accepting, spawning, etc away for me, such that I can focus on implementing (and defining) the actual protocol?

Marked As Solved

dom

dom

Does Ranch sound like what you need? https://github.com/ninenines/ranch

Also Liked

NobbZ

NobbZ

Thanks for the hint, I’ve heard about ranch before but always thought it were for short lived connections only. After reading some guides it seems to be exactly what I’m looking for. I’ll further evaluate it in the next days.

OvermindDL1

OvermindDL1

Just for anyone curious, ranch is the tcp connector library used by cowboy, which is the http server that plug/phoenix use. ^.^

Where Next?

Popular in Questions Top

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
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
Werner
Hi, I’m using Ubuntu 18.04 and after updating to OTP-24.0 yesterday i have this warning when I run “mix local.hex”: 14:57:30.512 [warn] ...
New
Kagamiiiii
Student & New to elixir. Nice language. I want to convert a english character, e.g. “a”, which is stored in a variable, to it’s asci...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
hpopp
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
Codball
Mix format works fine if run from the cmd. I’ve followed this to facilitate the implementation into VSC which involves downloading an ext...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

Other popular topics Top

lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
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
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
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
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

We're in Beta

About us Mission Statement