I have a liveview and I'm wanting to fetch some data from a remote http endpoint.
When I add the request to the mount function it appears to block the view and the websocket connection drops while loading the page. Obviously I'm doing it wrong.
This is an example of what I'm doing which is obviously incorrect
def mount(_params, _session, socket) do
data = fetch_data_from_external_service()
{:ok, assign(socket, :data, data)}
end
What's the correct way to do this in Phoenix? Is there a good practice example (or example project) I can follow?