


See this Looks like having 20,000 idle clients connected to a server sits at only 380MB and Erlang is at 737MB. And we’ll look at the lifecycle of a LiveView in more detail in the next video. There's a project called An圜able which replaces ActionCable to give Rails the real-time performance equivalent of LiveView. Since then we've built countless Rails apps, including the suite of apps that power this site and our custom video learning platform. In fact, Mike helped build one of the first production Rails apps in 2005 and co-taught the first official Rails course in 2006. Not one line of custom JavaScript! But there’s more going on behind the scenes than meets the eye. We've been using Rails since version 1.0 and teaching it for over 16 years. It’s a fairly simple (and fun!) programming model, all written in Elixir. Handle_event functions handle each inbound event by changing the state in the socket using either assign or updateĪnd whenever the state changes render is automatically called to render a new view for the updated state. ActiveRecord Algorism Angular Books CachingSystem Database Docker Editor Erlang Git JavaScript Linux LiveView Memcached Misc PHP Phoenix Rails Redis Ruby. Render uses a LiveView template to render a view for the state in the socket Mount initialize the state of the LiveView process by assigning values to the socket Stepping back, you gotta admit that’s a lot of functionality for such a minimal amount of code: Now if you head over to you should have a fully-functioning light controller. It works seamlessly with the Rails tooling you already know and love. StimulusReflex eliminates the complexity imposed by full-stack frontend frameworks.
Rails liveview update#
Def handle_event ( "down", _, socket ) do socket = update ( socket, :brightness, & max ( &1 - 10, 0 )) end An exciting new way to build modern, reactive, real-time apps with Ruby on Rails.
