Optional REST mode instead of WebSockets for LiveView?

Hi everyone! I’m thinking of deploying Pheonix LiveView on Cloud Run. But I looked at its pricing, and it has great pricing for REST requests, where it only charges you for the time you spend handling the request. The issue with WebSockets is that it treats a WS connection as a regular single long connection. Making the serverless aspect of Cloud Run pricing kind off useless.

What I’m proposing is an alternate mode, where on each event on the client side the client sends what has happened, and LV responds with the diff.

The issue is with server sent events. I guess the client would need to be constantly polling the server :frowning: Could be useful to customise the timeout between polls.

Anyway, just a suggestion.

A serverless model doesn’t really work well with a stateful server model like many beam projects use and liveview is one example of that. If to the ms pricing calculations sounds great to you I’d suggest not even using the beam, which even by itself brings quite a high startup time to the table.


Thanks for the answer.

Cloud Run actually rounds to the nearest 100ms. So I understood from that they don’t reward native code, so thought BEAM was fine.

Below a 1s cold start wouldn’t be terrible for me. You’re saying it’s slower than that?