Adding the LiveView Client Hook

If you’ve worked with Phoenix LiveView a bit, you know how simple it is to send updates from the server to the user’s browser and let it display the changes. You simply assign the new data to your socket. LiveView then sends the updates through the websocket connection to the browser. Once the browser receives the updates, the JavaScript part of LiveView re-renders the relevant parts of the UI. So, server-to-client communication in Phoenix LiveView is easy because the framework does all the heavily lifting for us. All it takes is a single function call and LiveView does the rest.

But this only covers the server-to-client communication. So, how does LiveView allow us to communicate in the other direction, from ...

Get Building Table Views with Phoenix LiveView now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.