简体   繁体   中英

How to send constantly updated data in http request?

Let assume I have computer A and a variable x which updated very frequently, and also takes some time for this update( Lets say: asked to be updated every sec and update tooks 0.5 sec).

Now, once a minute, I have computer B which asks in a HTTP GET request for x's value. A sends him a copy of x.

Because x might be used by A, I need to make sure that nothing gets wrong.
How can I assure it? What are my options for doing this?

I Think you can return x in function callback.

or like twisted reactor.callLater, server B could ask twice waiting for A get lasted result. but x update per-second, i may lead to other servers always request。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM