acrolink

acrolink

I thought of rendering the HTML containg the LiveView components using webview, but I prefer a more native way. How to achieve that ? Is there any helper libraries to use with Flutter (providing a similar experience to LiveView in the mobile applicatiin while communicating with a Phoenix back-end application) ?

Showing Posts 1 to 10

arcanemachine

arcanemachine

There’s a Dart package for interacting with Phoenix Channels:

I haven’t used it but it looks to be under active development.

There’s also a tutorial on GitHub showing how to put the pieces together:

https://github.com/dwyl/flutter-phoenix-channels-demo

Again, I haven’t done this tutorial, but I found the dwyl tutorials on GitHub to be very good when I was learning Phoenix.

Also, when I did go down this road, I did embed webviews into a Flutter app. The webview content can communicate with the “native” Flutter widgets via JS message passing. So your web stuff can be plain LiveView, and you can still interact with “native” Flutter widgets. Best of both worlds IMO since your web stuff can be reused on your mobile app. I encourage you to take a look at that before you make up your mind. (If you do, I found that this Dart webview package is way better than the official one, which was barely useable when I tried it ~2 years ago.)

jack456jokky

jack456jokky

That sounds like a fascinating challenge! If you’re aiming for a seamless experience like LiveView in Flutter, have you considered using Flutter’s stream and StreamBuilder? They can handle real-time data efficiently. Plus, integrating Phoenix Channels with Flutter can give you that native feel while keeping everything in sync. Excited to see where this project takes you!

Nicodemus

Nicodemus

Another option might be LiveView Native… I think it would be theoretically possible to embed both LVN and Flutter in a single app for different parts of it, wherever it makes sense. Of course, LVN is not yet ready, but something to keep an eye on.

LostKobrakai

LostKobrakai

I don’t think this has been mentioned yet, but LV does use more than just a phoenix channels client. The client would need to implement an alternative to morphdom and it would need to implement a resolver for the template diffing structure LV uses to send diffs on the wire. Then there’s all the event integrations for clicks, submits, … LiveView Native did invest a lot to make those things work for iOS and android. They do however have a shared library in rust, so they don’t duplicate work between the platforms. Maybe that one could (eventually) be used to power a flutter based approach as well. Though if you can go native why use flutter then I guess.

acrolink

acrolink OP

In the Flutter Application I will use Firebsase Authentication. Do you think it will be possible to initiate the authentication in Flutter natively and use the Firebase access token inside the webview ?! I mean to send the access token inside the conn of LiveView inside the webview ?

arcanemachine

arcanemachine

If there is a reason that you can’t just use Postgres, you could probably make it work.

I have wrapped the mix phx.gen.auth generators to work with an external token before. It isn’t super difficult to do.

But it would be way easier if you could just do the auth in Phoenix, and use that auth token to determine which screens should be displayed in the Flutter app.

acrolink

acrolink OP

I need to authenticate the user in order to retrieve his personalized data .. Not just a matter of allowing or preventing access to certain pages.

arcanemachine

arcanemachine

OK and where is this personalized data stored? In Postgres or Firebase?

I don’t remember if Phoenix has out-of-the-box bearer auth token support, but you can modify the phx.gen.auth generators to support this.

acrolink

acrolink OP

Postgres, will be eventually on AWS Aurora (Postgres based) with all nodes (Phoenix instances) accessing the same DB.

I guess even if I will be using an embedded webview in the smartphone application, I can still initiate the Firebase authentication natively in Flutter and then use the access token in order to initiate the socket connection, which will on Phoenix side, on connect event, look up the UID in PostgreSQL and assigns it to conn.assigns and that’s it.

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
rahultumpala
Hello, I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews