Are you all in on LiveView? How are you using it?

I’ve been using LiveView since 0.14.8 and am currently using the 0.15.7 with Metamorphic in production.

I just relocated, absolutely fried, and am still settling in (working on boxes right now) from my last post, so I may forget some details of how I’m using LV but essentially:

  • The whole app is LiveView with a few exceptions, like the log in page, but all major features are LiveView based (including the video chat through a WebRTC peer-to-peer mesh architecture). This is expanded from Jesse Herrick’s wonderful blog to include authentication and tie-in more with the specifics of a person’s account on Metamorphic.

  • I’m using LiveView with ETS to handle in-session, temporary decryption of people’s images (for our Memories feature). I first noticed an incredible amount of latency (more than several seconds worth) on my first pass, but then switched to storing only the decrypted binary in ETS and that’s provided a significant speed boost. Now, the latency appears to mostly be coming from the initial call out to AWS to pull down people’s encrypted files (they are asymmetrically encrypted with people’s password-derived keys so that Amazon or any future cloud provider never receives anything but an encrypted blob — which is then encrypted with their own provided encryption). I’m not currently compressing the ETS tables but it is something I’m considering if I see space issues in the future.

  • In terms of improving the call out to AWS, I keep coming back to finch but, alas, I’m too fried at the moment to understand how I might leverage it to improve the speed there (but something tells me I will be switching to something like req in the future).

  • I’ve noticed stateful components for the settings section of the app, which is divided into tabs, have a significant load time but I haven’t had time to test and dig into this more yet.

  • I supplement LV with AlpineJS (currently a mix of v2 and v3) as noticed on the opening invite page. Alpine is also used for things like dropdowns. Overall that experience has been incredible, and I use it with LiveView to talk to a GenServer for our passphrase generator (which uses the dice strategy from the EFF).

  • For hooks, I really try to lean away from hooks whenever possible just because it’s so intuitive for me to write only in LV. However, I do use hooks for our Portals’ WebRTC, Stripe payments, and TOTP modal.

  • As @tj0 notes, Safari often behaves differently and one funny moment of panic came when testing the production site on the road on my mobile phone and discovered that the site wasn’t informing me that I had successfully (or unsuccessfully) confirmed my email via the email link. It turns out that if you enable “Block all cookies” in Safari, it does just that — even the functional ones! Since, I use session cookies through phx_gen_auth, this setting was throwing the site for a loop (but it still didn’t crash). The episode also inspired me to write a short blog piece on Metamorphic’s cookies and turn off “Block all cookies” in Safari.

  • Another great thing about LV/Elixir - I was running on autoscale for awhile with my hosting provider to scale up and down instances of the app, when I suddenly realized that I hadn’t configured Metamorphic for clustering. Suffice to say, some strange behavior occurred (missing messages) but, again, the app didn’t “crash”. I have since updated and fixed this and we are set to autoscale (things like this occur when programming in between raising a little one).

  • I’ve also been considering Fly.io, I’m just hesitant to make the headspace to learn the necessary ins and outs (docker, etc) and my hosting provider has also told me that multi-region support is on their todo list. But, again, Fly’s case for LV is extremely compelling and people will be using Metamorphic from around the world.

  • Weird behavior - typically I notice weird behavior occurring between LV and webhooks. I’m currently noticing that sometimes the server-to-webhook-back-to-server will get out of sync (typically an issue with internet connectivity) and then the client-side will act as if their action wasn’t successful when in fact it was.

  • Testing - I’m mostly testing only really critical things (payments, authentication/security/encryption, authorization, password generation, major features) at the moment. However, I am performing real-world testing continuously. This is much slower and more cumbersome but it helps me see what it will be like for someone to actually use the app (it also often inspires new ideas or changes to existing things as I see how they look and behave in real-time).

  • Emails have been incredibly annoying to configure for HTML with Tailwind (using the latest). When I test the built-in HTML preview client with Bamboo the email looks exactly how I want it to look. But, when I perform a real-world test, I notice that my email client is stripping away the HTML and my button is no longer an awesomely styled button but the base HTML. I’ve since opted to just style the emails simply until I can return to figuring out the discrepancy that is occurring.

I’m currently at the early stage of the Early Access phase for launching Metamorphic, so not everything is completely ready yet (I’ve had to settle for 3 main features at launch rather than the current 8 that are on the drawing board).

If you visit the site, I am now taking sign ups and will be slowly rolling out invite emails to people who’ve signed up in the next several months.

But, some things currently working on for Early Access:

  • Adding a TURN server to the STUN implementation of our video chat Portals.
  • Updating LV to 0.16 (the new HTML engine is both exciting and daunting in terms of upgrading all of the existing files)
  • Improve and expand my automated tests
  • Features

It’s also unclear how my ETS strategy for handling in-session, temporary decryption of people’s photos will perform under heavy use. However, I’m currently running on very under-powered production hardware (only 1 cpu) and plan to scale that hardware as the number of people using the service grows.

I’m growing bleary-eyed so I’m going to leave it at that. But, overall, I am definitely all in on LV. It’s such a wonderful programming experience (and looks to be improved with 0.16 from the changelog).

11 Likes