Jeykey

Jeykey

Issues with Flutter and Phoenix Channels

We’re having some issues with our Flutter App and Phoenix Web Sockets. We know that the Backend is working properly, since the JavaScript client is fully functional. But with the Flutter app we can’t connect to the server.

final socket = PhoenixSocket("ws://###.##/socket");           
connectSocket() async {
await widget.socket.connect();
_channel = widget.socket.channel("test:lobby")
_channel.on("say", _say);
_channel.join();
}

One of the errors were gettig:

I/flutter ( 4227): WebSocket connection to ws://###.##:8080/socket?vsn=2.0.0 failed!: WebSocketException: Connection to 'http://###.##:8080/socket?vsn=2.0.0#' was not upgraded to websocket

On the client side we’re using Phoenix Wings, the port and URL are correct.
Why does this keep happening?

Are there any other libraries for Flutter with Phoenix Interactions? Is there a better documentation for phoenix_wings or for any other packages?

Most Liked

OvermindDL1

OvermindDL1

Are you sure that /socket is the websocket and not the phoenix socket? Remember a phoenix socket is a number of things, like longpolling, websockets, custom things, etc… If the phoenix socket is mounted at /socket then the websocket would generally be at /socket/websocket unless changed.

If it is a client-side phoenix library I’d imagine it already took that into account though.

Should also be using wss/https too.

Where Next?

Popular in Discussions Top

New
ricklove
I was just introduced to Elixir and Phoenix. I was told about the 2 million websocket test that was done 2 years ago. From my research, t...
New
crispinb
On reading dhh’s latest The One Person Framework it strikes me that Phoenix with LiveView is already pretty much this. However, never hav...
New
CharlesO
Erlang :list.nth simple, but 1 - based nth(1, [H|_]) -> H; nth(N, [_|T]) when N > 1 -> nth(N - 1, T). Elixir Enum.at … coo...
New
crabonature
I’m still quite new to Elixir. As I understand we got in Elixir “multi guards” as convention to simplify one large guard with or’s?: de...
New
rower687
Hi all, I’ve been reading a lot about the “let it crash” term and how supervising processes and the whole messaging passing make an elixi...
New
eteeselink
Hi all, In the last days, two things happened: A blog post titled “They might never tell you it’s broken” made the rounds. It’s about ...
New
und0ck3d
Hello everyone! A few days ago I’ve created a topic here about how people were creating CMSs with Elixir and Phoenix. I’ve been studying...
New
joeerl
I’m playing with Elixir - It’s fun. I think @rvirding does give Elixir courses these days. Re: files and database - when I given Erlang ...
New
kostonstyle
Hi all How can I compare haskell with elixir, included tools, webservices, ect. Thanks
New

Other popular topics Top

marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
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
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
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
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

We're in Beta

About us Mission Statement