I think of two methods: 1. if any data is returned from the last time period, chrome can use the last 3 seconds, but Firefox uses the last 5 seconds, firefox often fails to fetch data. chrome will retrieve repeated data in five seconds. 2. second... I think of two ways:
1. if any data is returned from the last time period, chrome can use the last 3 seconds, but Firefox uses the last 5 seconds, firefox often fails to fetch data. chrome will retrieve repeated data in five seconds.
2. the second approach is to mark the database as read. However, because different browsers do not synchronize the data obtained from different terminals, one of them is marked as read after obtaining the data, other browsers cannot obtain the data.
So what should we do?
Reply content:
I think of two methods:
1. if any data is returned from the last time period, chrome can use the last 3 seconds, but Firefox uses the last 5 seconds, firefox often fails to fetch data. chrome will retrieve repeated data in five seconds.
2. the second approach is to mark the database as read. However, because different browsers do not synchronize the data obtained from different terminals, one of them is marked as read after obtaining the data, other browsers cannot obtain the data.
So what should we do?
The second approach is acceptable, but to optimize it, you can obtain the latest data update time from the server in the table memory and the terminal time is smaller than the table time, it indicates that new data needs to be pushed.