Real-time Data Updates with Fetch API - JavaScript Tutorial

preview_player
Показать описание
In this video I'll take you through the process of using short polling in combination with the Fetch API to achieve the effect of "real time" or "live" data updates with JavaScript for your web projects.

Short polling involves asking the server for a fresh copy of information every set amount of seconds. The example in this video demonstrates a live view count for a piece of media content.

Support me on Patreon:

For your reference, check this out:

Follow me on Twitter @dcode!

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!
Рекомендации по теме
Комментарии
Автор

This is not an ideal solution for live data pulling/update. It will keep calling data from server. Imagine if 2 million requests done this way simultaneously, it will overflood the server with requests etc.

kuhak
Автор

Would using server-sent event be an alternative to this technique ? which one is more performant ?

theartist
Автор

Can we update data with python insteas of php

utkarshchauhan
Автор

is that gonna slow down the performance when we refetch >100 table data every 2 seconds?

Fathurrr
Автор

It's NOT "real-time". It's periodic updates

aarkaev
Автор

thanks for the video.. I don't know it could be as simple as this to make the API and also fetching the data (I'm new to AJAX etc) and also so fast when you clicking that TAB button 😂😂

hanisirfan
Автор

Well its not real-time but it solves my purpose. Really helpful video! Thanks!

tusharniras
Автор

What about 100ms? What's the safe minimum interval?

okeyeng
Автор

How can I modify this code to send Ajax request to PHP to update a database value every 30days

ifeanyinnaemego
Автор

Boa aula, porém acredito que um setinterval a depender do tamanho da aplicação e do número de requisições haja necessidade de um servidor de grande processamento

TheRaiat
Автор

Can I put url of a website in data, will it fetch the data as the whole website is only having a four digit number which change after every refresh.
Please reply it is very urgent

apoorvgupta
Автор

Good tutorial thanks. I'm wondering if I need to use data as a parameter for another function out of setInterval, I mean get the current data and use that data for a different function for example create a function with an alert(), and run it only once and not every two seconds. What do you recommend for this task?

omargian_stw
Автор

is their a way to use javascript instead of PHP to append view count

kasper
Автор

multiple rows data updated is possible? if yes please help me.

mehedihassan
Автор

Java has a footer in the middle of the official site 💀

pickashoe