Android to H5 frequent JS return to the timing disorder problem

The logic is like this: The client needs to monitor the change of the volume of the user at all times, and then notify the web page. When the volume button is operated very frequently, the callback to the webpage will be very frequent. If the network is particularly good, it is almost normal. If the network is unstable, a problem will occur, that is, the data received by the webpage may be disordered. For example, if the client transmits 12345 webpage and received 12354, if it involves some logic of the webpage, then the processing of the webpage will also have problems.

Processing method: It is to add a timestamp field when transmitting, so that when the web page is received, it can be overwritten according to the timestamp, and the largest timestamp is used to ensure that the data is up to date.

Guess you like

Origin blog.csdn.net/lk2021991/article/details/105495180