I have traversed a set of data from the database, rendered into the table, now requires the background to change the data in the database, the foreground can immediately change the data. Best to give a reference code, thank you.
Reply content:
I have traversed a set of data from the database, rendered into the table, now requires the background to change the data in the database, the foreground can immediately change the data. Best to give a reference code, thank you.
HTTP is stateless.
Therefore, in theory, it is unrealistic for the server to proactively push information to the client.
Of course, the method is some, is the client JS polling, there are long connections, websocket, the actual application of seemingly polling methods used more.
The simplest implementation, the front-end JS code design a timer, and then each time interval to query database data updates, of course, so that the pressure on the server is conceivable, the need for data storage and query methods to do a lot of optimized design, appropriate cache.
I have a project the user is not many, the data in 20 field around, 1W records within, the pressure itself is not very small, using the data from the database to get the snapshot serialized into the SAE KV database, the server changes, while updating the KV database content, the client query is updated, The direct use of KV data to express, to a certain extent, to solve the pressure problem.
I wish I could give you some inspiration.