I would like to discuss a website I am managing that uses Phoenix LiveView (version 1.0.0-rc.0).
The website is running on VM instances on Google Cloud. Each instance is running Nginx as a reverse proxy, relaying requests to the Phoenix app.
Initially, I used Google Cloud Load Balancer in my configuration to distribute requests to the VM instances. On the surface, the website appeared to be running fine. Websocket communication between the browser and LiveView was working.
However, one problem was uncovered. If the browser is left idle for about 60 seconds, the screen reloads.
After checking with the Chrome DevTools, I found the following:
- The first heatbeat sent from the browser to LiveView returns OK.
- However, the second heatbeat did not return a response.
So I stopped using Google Cloud Load Balancer and built a simple load balancer using Nginx in front of VM instances. Then the problem was solved.
From this, I concluded that the problem was caused by Google Cloud Load Balancer and decided to use Nginx as a load balancer for the time being. However, I would like to use Google Cloud Load Balancer if possible.
Has anyone else encountered a similar phenomenon? If there is a workaround, I would appreciate it if you could let me know.