Live update frontend

How can I update a webpage live, without the user refreshing the page or doing any thing?

Example: Audience is awaiting a live video stream to start, but until we go live, we show them a promotion video. When our artist is ready, we reveal the live video.

I imagine that I must use fetch-api to replace content (video url). But how do I do that in a smart way? Will fetch need to be run every second, and wont that use many resources. Thanks so much!

In this situation, you would have to use websockets or something along the lines of to trigger an update for the client from the web server. On the server if you trigger an update,it will get sent to the client. Constantly refreshing would be a giant waste of resources for the server.

More about

Happy coding. :slight_smile:

1 Like

Thanks for getting my focus off fetch-api, and to the server-side. It is a new chapter for me, so I must look into it. I hope to be able to do this with serverless, like AWS lambda. Again, thanks for helping!