On page 138, :timer.sleep(1000)
is used in the server-side code to simulate latency. This would be a great place to introduce the client-side liveSocket debugging function liveSocket.enableLatencySim()
. The developer can achieve the same latency by running liveSocket.enableLatencySim(1000)
in the browser console, which allows them to avoid unnecessarily mucking with their server-side code. (I mean, who’s never left a breakpoint in their code by accident? Definitely not me…)
Then, to reset it, you could describe the similar usage of liveSocket.disableLatencySim()
.
Also, a link to the docs never hurts: JavaScript interoperability — Phoenix LiveView v0.19.3