现在项目上有这么个需求,客户拿着APP去一个深山老林里(或者去一个偏僻的村庄)去和核查情况,网络情况不是很好,有可能是2G网络 也有可能时刻断网,但是他要通过APP与服务器交互了,首先是登录就要与服务器交互,然后紧接着获取一些核查规则来查看,这些都是返回的json字符串,手机端进行解析,但是这种弱网络情况请求应该会很慢很慢吧,有没有一种方式能够变快呢? 我查阅了一些资料,网上说:服务端通过将数据压缩后然后传递给客户端,客户端在进行解压,在解析json并展示···· 哪位大神遇到过这种需求。求给个思路。谢谢!
Data compression is used to reduce the amount of data transmission. It can increase the speed under weak network, but it will be slow when there is no network. Is it possible to make a prediction model and predict the pre-sending of request content in the next time period based on the relevant parameters provided by the app?
Cache the last request. The server will only deliver the changed content under weak network conditions, and insert the changed content into the last cache for display. This network is the most economical.
Data caching, the requested data can be cached locally for data display, and the data that needs to be uploaded can also be cached locally first and transmitted when the network signal is good. Wait for failed reconnection,
Compression is needed to improve the efficiency of network transmission and shorten the request interaction time as much as possible.
Also pay attention to prevent duplicate submissions. (Guarantee the idempotence of some interfaces)
Weak network means there is a network. As long as you ensure that the network is constantly connected before the server responds, it will be easy to solve. Make sure that the size of the request body and return body is small enough to have no friends. Compress it as much as possible...after receiving the response. Just parse it on the client side.
Data caching is needed to ensure that the previous data is displayed on the page before new data is obtained; data that has been read is cached to avoid repeated network requests; data compression is mentioned above.
Use xml to transfer data, save it locally, and display local data when there is no network connection
SQLite stores some data. Sensitive data is abbreviated as parameter length. It is judged whether there is a return value in http and then sent again
There is something called MQTT