Websockets in 0.19? Phoenix & Elm 0.19?

Hey good people, just trying to get a handle on the status of Elm WebSockets these days.

At some point, we need to cut over to 0.19 (or at least, I’d like to, purely for decreased compile times. That’s literally the only reason.)

Our app uses Phoenix WebSockets on the backend, and we use

which is an effects manager, so no good in Elm 0.19.

I came across an article on folks who also use Elm/Elixir but elected to strip out WebSockets altogether and go HTTP only when upgrading to 0.19. I’d rather not do this if possible as right now it’s working spectacularly well.

Just wondering if:

  1. Anyone has upgraded a Phoenix app to 0.19 and kept WebSockets
  2. The status of WebSockets in Elm 0.19

Rock on,

1 Like

Have you seen the ports approach:
https://package.elm-lang.org/packages/billstclair/elm-websocket-client/latest/

Thanks, yes I did come across that!

I might try it to see how well it works…

:smile:

I’m using ports for this in a 0.19 app I’m working on and while your mileage may vary, for me the transition was a lot easier than I thought it would be. In some ways it’s been easier than when I was using straight-up Elm for it in 0.18 because I don’t need to pass the socket state around the app like I did before.

2 Likes

Cool, glad to hear!

Yeah, I may just use ports and roll with the standard Phoenix Channels JavaScript client directly:

https://hexdocs.pm/phoenix/js/

ps still, if anyone reading this has a sense of WebSockets in Elm 0.19, feel free to chime in!

We use websockets via ports at work, and it’s working well for us.

1 Like

Couldn’t you use ports via the subscription part of graphQL?
Well, just checked and it’s also using the port route :slight_smile:

Cool, yeah ports + Phoenix JS client it is!

1 Like

I have repeatedly asked about porting over the 0.18 websockets to 0.19. At this point it has been a year, every time it goes up as a request the response is “use ports” and a port isn’t even on the list of things to eventually get to. I would say that if the piece of the JavaScript API (e.g. websockets) is not implemented in 0.19 by now it never will be. Time to look for a different solution.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.