I plan to write my own small project using Phoenix LiveView for the browser, but I am also interested in creating an application for Android/iOS.
LiveView makes it easy to create web pages, but due to the specific interaction with the server, it will not be possible to create a mobile application based on the same code.
Surely someone had a similar experience. Are you creating a separate CRUD API for the app?
I know about the existence of LiveView Native, but it’s still too raw.
I’m new to Elixir and don’t know much, but I like the ecosystem created for writing websites. But you may have to duplicate the code for the mobile app.
You can always wrap a webview in Flutter/React Native/Capacitor. It’s not optimal UX, but if you want something that runs on all platforms, and also allows for native mobile app integrations (location, notifications, etc.), then it is an option.
Live View communicates over websockets, on the first load it sends a static html page template with dynamic parts and subsequently it sends diffs on the dynamic parts of the html. I think in essence there is no reason why you cannot connect to this websockets and listen to these messages. The only part that is useless to you is the static html page.
If you want to get fancy you could update Phoenix live View to send a static json instead of a html page and on the client update your json or app state with the diff messages.
LiveView transmits data not just to WebSocket or Phoenix Channels, but in its own format, specific to the framework and the specific place on the site where the widget needs to be updated.
That is, something like this JSON:
{ “1” : { “0”: “…” } }
And it is unpleasant to read it. What if it changes during the update or just like that? It doesn’t fit.
Well, I understand that no one has any other options but to create a separate JSON API and partially duplicate the logic.