OvermindDL1

OvermindDL1

Elm-phoenix-socket question

I’m looking in to Elm again as I am really not liking javascript, but the last time I touched Elm it was with elm-phoenix-socket and it did not have the capability to re-use the existing javascript socket while also lacking heartbeat. It seems to have heartbeat support now, but still lacking the presence functions that are in the phoenix library (though may be PR’d in soon? Maybe? They seem to be thinking no for some reason…).

Right now the phoenix app I have is built using react + phoenix + bootstrap (bootstrap is required by other business stuff), little else. I would love to write it in a better language, however it seems elm-phoenix-socket is still not capable of re-using the javascript phoenix socket to make new channels. Does anyone know of a work-around?

At the moment I have a single socket that is passed to multiple React components for the few dynamic components on the webpages that I have, need to keep it to one websocket connection as well. So I see two ways to go with this now:

  1. Try to finagle Elm into using the javascript web socket via injecting the events and such via its ports interop, seems like it would work, also sounds like a lot of work as some things like phoenix presence might even be more easily rewritten inside Elm instead of linking javascript as Elm seems to hate mutable things like the presence part of the library does to mutate an object as events come in.

  2. Write it all in Elm, this involves re-writing a not-insubstantial amount of code, but not a large amount either, however I cannot seem to figure out (still new to Elm and elm-phoenix-socket) if elm-phoenix-socket can spool up a single websocket and share it out to multiple embedded components so they can make their own rooms. As far as I can see each embedded component/application will spool up its own websocket, which is a big no-no for what I need to do.

Anyone have ideas? :slight_smile:

First Post!

dardub

dardub

I thought the Elm team was planning on adding an official library for Phoenix sockets. They’ve been hinting at more Phoenix integration due to the popularity of Elm in the Elixir/Phoenix community. Maybe ask around on the Elm slack channel? Sorry, I don’t have anything else useful to say, so just ignore if that doesn’t help. :smiley:

Where Next?

Popular in Questions Top

hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
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
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
vac
Hi, I’m quite new in Elixir and I’m trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and I...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
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
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
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Other popular topics Top

malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
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
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
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
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
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
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

We're in Beta

About us Mission Statement