Advice on architecting a LiveView app without real-time requirements

Hi all
I have a project related to real estates with the following high level requirements:

  • a simple landing page
  • web app for users to enter properties, modify and view them
  • upload images
  • run periodically background jobs
  • The web app does not require real time information from other users. I would like to provide form submissions and navigation without a full page reload.

My question
Would it be an overkill to building this app with Phoenix LivewView?

Based on what I know about LiveView you can achieve the required UX. However using a websocket, which is non stop open, for this app seems to be too much for me (I might be wrong). What are your thoughts?

Thanks!

LiveView (with WebSocket) sounds like a good choice. It will provide navigation, submission, and file uploads without page reloads or JS.

@LadislavSzolik If you don’t need real-time use https://unpoly.com/ instead of LiveView and avoid js fatigue altogether - it’s just plain HTML over the wire (thank me later :wink:).

2 Likes

I never heard of this project. Thanks for the recommendation!

1 Like

what is your opinion about having a socket connection always on? I am not a network specialist, but it sounds like something what requires more resources than the usual AJAX API.

I would not use anything other than LiveView for forms, except the dead simple ones, anymore. I guess I am spoiled.

2 Likes

That depends on many factors and might not even be a factor at all.

Say the websocket would consume 5mb per connection; and there are 5 concurrent users max, your server will smile as it can’t care less if the app uses 5 or 25 megabytes as it has 2.000!

However, using LiveView makes many things so much easier, it enables you to easily add and extend functionality of the platform. Then the server does not care, but you are a much happier person.

  • Most higher memory usage can be fixed by Phoenix’s temporary assigns. Then a large list for example is not stored in the socket process. But only use it if you know from facts that you need it.

*currently rewriting a heavy React app to LiveView as a POC. It’s a breeze to work with (and in the code)

If performance/overhead is the only concern, then WebSocket might not be the top pick. But there are other areas where LiveView could provide an improvement such as development speed, maintainability, extensibility, and testing - depending on your team, of course.

2 Likes

Thank you for your answer.

I guess I phrased my question incorrectly. This is a green field project and we can decide on technology. I am learning Elixir/Phoenix and I could not figure out, whether the LiveView was meant for real-time/ chat apps only or for interactive applications in general?

For webapps/sites in general.

Even though you don’t have realtime requirements, you might find yourself some time down the track in a situation where you want to push something to the client and you’ll be glad to have it there at your fingertips.

2 Likes

I use the one minute rule: do you expect your user to interact with your website within a minute? If so, the staeful overhead of a live view is justified. If not, a static view may be more appropriate.

1 Like

Alright, thanks everyone for taking the time to answer. I really appreciate it!
We are designing the user flows, and I will get to work to produce the first version of the app with phoenix.