TODAY I LEARN

Client-Side debug for Phoenix LiveView


If we see the app.js file in the phoenix project we can find the this line at the end.

 window.liveSocket = liveSocket

What this line is doing is exposing the liveSocket instance on the window. So, now we can access the liveSocket on the console of our browser.

To enable the debugging and see what response we are getting when we make the request to Phoenix LiveView page from the browser, we can simply add this line in browser console.

 liveSocket.enableDebug();

And for disabling the debug we have

 liveSocket.disableDebug();