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

_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
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
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
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
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

Other popular topics Top

Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
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 Postgres...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39297 209
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New

We're in Beta

About us Mission Statement