Live data from Hacker News

Build a real-time Twitter clone with LiveView and Phoenix 1.5

phoenixframework.org

111–120 of 249 posts

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#111

Earlier quoted context omitted.

LiveView does not re-render the template on every interaction. LiveView actually sends patches over the wire, which is typically smaller than a hand-written JSON response. The screencast linked above has a good example of this, where clicking the "retweet" button sends a minimal payload, since we know the exact position on the page. LiveView also uses a long-running WebSocket connection and that reduces the amount of…

The patches don't need to be processed by the template engine to render them?

It turns out that Elixir/Phoenix templating is, in general, astoundingly fast, and that diffing operations are highly optimized at the language level due to the data structure (IO list) used.

Here's some information: https://www.evanmiller.org/elixir-ram-and-the-template-of-do...

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#112
post #103

Earlier quoted context omitted.

To add to this, it's worth noting that Elixir would have difficulty _ever_ becoming statically typed because of how message-passing works. For example, if you look at Gleam [0] -- the recent project that's trying to create a statically typed language for the BEAM -- it can't handle message-passing [1]. And I totally agree with you here: > I've found that it's possible to pretend it is a statically typed language if y…

I've heard a number of times that static typing would be near impossible for Erlang because of how message-passing works, but just the other day I read a quote where one of the creators (I think it was Joe Armstrong, but not completely certain) indicated that the primary reason they decided against static typing was the hot code reloading, not the feasibility. or not primarily anyways. Not disagreeing with you, I gue…

I'm the author of Gleam, a statically typed language on the BEAM.

What you've said matches my findings. Messages can be typed, however hot code upgrades cannot be. For Gleam we've sacrified hot code loading in exchange for types, which I think is a good trade for most use cases.

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#113

Earlier quoted context omitted.

Go may be popular, but is also a lot less complete. Some other things to consider are that Go's concurrency model is quite bloated when compared to Elixir's, Go uses public memory for its goroutines vs. Elixir's private memory that protects processes, Go uses cooperative multitasking vs. Elixir's preemptive model, and Go's dependency handling is absolute rubbish. Elixir's process supervision is amazing and Elixir's p…

Which would you say is easiest to learn, for someone with a little programming experience? I'm currently planning a SaaS project and had settled on go, but this discussion is making me wonder if perhaps Elixir is the better choice.

I think the basics of Elixir are easier to learn. The syntax is pretty straight forward and you don't have to worry about much more than functions and modules.

OPT, which is how you build supervision trees and other more complex Elixery things, is tricky at first but reading through Designing Elixir Systems with OTP, by James Edward Gray & Bruce A. Tate, and The Little Elixir & OTP Guidebook, by Benjamin Tan Wei Hao should clear it up fairly well.

This is highly subjective, of course, but I've written code in C, C++, Pascal, Basic, Python, Perl, Ruby, JavaScript, Go, PHP, Java, C#, Clojure, Scheme, Cobol, and Pick Basic (of all things). Elixir has been my most favorite language so far.

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#114

This is by far the most amazing demonstration of framework capability that I've ever seen. I'm stunned. HOW do you manage to broadcast only the minuscule change of a number to all of the connected clients with server side rendering? I'm trying to wrap my brain around it.

Chris McCord has given some talks and explained this - eg see https://www.youtube.com/watch?v=8xJzHq8ru0M at about 22 minutes in

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#115

Looks interesting but I am not interested in making timelines .. is this Phoenix framework general enough to make arbitrary real time web apps?

You can see some other examples of LiveView apps at https://phoenixphrenzy.com/results

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#116
post #14

I was a Rails user for almost a decade. I switched to Phoenix/Elixir 3 years ago. Elixir is a super simple language. It has no OO concepts and everything is functions first. In fact, it's so good that I started teaching it for universities. All my production web applications are now fully on Elixir. Elixir is one of those languages where everything has been done perfectly as of the time of this comment. When I say pe…

[deleted]

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#117

Earlier quoted context omitted.

How stable do you expect LiveView's API will be going forward? I'm especially invested in this since I've just rolled out an alpha of a project that may incorporate it in the future: https://phoenixigniter.com

As always, I can make no guarantees before 1.0, but we have really focused on refining the programming model and APIs for the last several months, so we're in a good state currently.

[deleted]

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#118

We are really excited about this release! I also wanted the screencast to be a single take, so I'm happy to answer questions if there are gaps to fill in for things I could have explained more clearly.

Any hope of getting this as a text article, or even a git repo? Blind user here who can't see code embedded in a video, but can read ascii-text with a screen-reader perfectly fine. People who don't enjoy videos for various reasons would probably like a text version too.

> People who don't enjoy videos for various reasons would probably like a text version too.

Yes this. I went to the video eagerly looking for a repo link and was disappointed not to find one.

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#119

Looks interesting but I am not interested in making timelines .. is this Phoenix framework general enough to make arbitrary real time web apps?

i'm currently using it to make a board game where updates are pushed live to everyone. it's the most pleasant experience i've ever had writing a webapp.

Re: Build a real-time Twitter clone with LiveView and Phoenix 1.5

#120

Oh, holy crap, I'm stoked, as someone who has just started using LiveView after like too many years of single page apps... all I can say, is "oh fuck, did we get it wrong." The experience is truly great. Also, LiveComponents are pretty awesome since they don't have their own process, just mount in existing LiveView, it makes 'em really easy to reuse and performant (at least from my experience so far). Writing UI code…

I feel your pain on SPA's.... I feel like code velocity drops on small teams.

What about LiveView/Phoenix made the process more enjoyable - let's call it 'less painful'?

Post reply on HN