When you visit a URL that serves a Phoenix LiveView, the process begins similarly to any HTTP request by initializing a `%Plug.Conn{}` and processing it through a series of plugs. However, for LiveView, the interaction extends beyond this point. The initial HTTP request renders a static HTML page, which includes Javascript to open a websocket connection. This websocket allows for full-duplex communication, enabling real-time updates without refreshes. The LiveView mounts, handles parameters, and renders content again once the websocket connection is established.

9m read timeFrom arrowsmithlabs.com
Post cover image
Table of contents
The codeThe initial HTTP requestMounting the LiveViewOpening the websocketmount/3 is called twice

Sort: