More convenience functions to deal with assigns inside LiveView

They’re just straight up different connections from the client browser. When the browser first goes to say http://example.com/page it does an HTTP GET request. To respond to this GET request Phoenix does the static render to return static HTML. The static render is done at this point, and the Elixir process that handled it has come and gone. The HTML contains the CSS and Javascript links, which the browser also then loads and runs (assuming the browser is setup to run javascript).

The Javascript includes your Phoenix LiveViewJS code, which then connects and opens a websocket connection to the server. It’s then over this websocket connection that the second render occurs to establish the actual connected live socket.

2 Likes