NobbZ

NobbZ

Socket.io server in elixir

As we are currently evaluating server side technologies and I’m in the position to push elixir in my company here, I want to re-implement the current functionality of one of our backend modules in elixir, showcasing its capabilities.

I have some restrictions when doing so though of which I can solve the most, but one remains:

I am not allowed to break the current client software, which uses socket.io for real time communication with the backend among the usual HTTP-RESTful-API.

Is anyone of you aware of a server-side socket.io implementation in elixir (or erlang) that nicely integrates with Phoenix or Raxx?

I doubt beeing able to implement one on my own in the time I have.

Most Liked

chrismccord

chrismccord

Creator of Phoenix

Phoenix 1.4 included our rewrite of the channels layer, so you should be able to implement the Phoenix.Socket behavior and speak the socket.io contract. Check the Phoenix.Socket source to see how we implement multiplexed channels on top of the behaviour.

allyraza

allyraza

I am not aware of elixir implementation of socketio server, But I do know of an erlang implementation which I don’t think is actively being developed

nonblockio

nonblockio

Hi folks, I meet the same problem recently :joy: Is there any solution?

NobbZ

NobbZ

Last commit was many years ago, so I fear it is to old for what I need. My front-end GUI told me that I need to be able to communicate with a 2.0 client.

Neither him nor me are sure if that is a protocol version or the clients version.

I’m also able to tell, that on the server side currently flask-socketIO is used in version 3.0.x.


If I only knew any details about that contract or they were properly specified in terms of a human readable document rather than untyped JavaScript as a reference implementation…


But as I have the python sources of the currently used server side library, perhaps I am able to re-implement the used subset for a start and extend on that…

A single week is very little time for re-implementing one of the transport protocols… Logic in that module is asymptotic to zero. Mainly its querying a database on one endpoint (and converting the database output to the needed JSON structure) and relaying messages from AMQP to the client and translating those system events to a simplified form that only contains category and label.

kartheek

kartheek

Take a look at Phoenix.Socket.Transport — Phoenix v1.6.6 and you should be implementing socket.io protocol on it.

Below article implements binary WebSocket as Socket Transport -

Phoenix Socket expect heartbeat every 60 seconds - I think you have to figure out something on client side.

If phoenix socket doesn’t work out - may be you have to use cowboy web socket.


I have a question - why do you want to use elixir/erlang for socket.io ?

Where Next?

Popular in Questions Top

gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
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
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
mathew4509
I have a list say x = ["23gh", "56kh", "97mh"] I would like to pass each element to Val in each iteration. Say, in iteration 1 -------...
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
kostonstyle
Hi all I want to have a unix time, from the current time plus 1 hour. DateTime.now + 1 hour How to get it in elixir? Thanks
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New

Other popular topics Top

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
dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
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
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

We're in Beta

About us Mission Statement