node.js - How does nodejs cache requests from mobile apps, process them in batches, and return processing results to the app at the same time?
巴扎黑
巴扎黑 2017-05-16 13:45:28
0
1
687

The current situation is: the Android app sends a registration request to the server built with nodejs, and nodejs is responsible for calling the relevant API to register with Huanxin.
However, Huanxin has limited flow for the API, so it wants to do batch processing, such as The api for batch registration is called once per second.
(Instructions for limiting the current limit of the environment signal interface: http://docs.easemob.com/im/45...
The problem now is that first of all, I don’t know much about the cache request. Is there a better way? Secondly, for each request sent by the Android app, a message must be returned to inform the success or failure. If it is cached for batch processing, how to return a message to the app?

巴扎黑
巴扎黑

reply all(1)
淡淡烟草味

Use queues and asynchronous callbacks to reply to requests. Each request has a callback function. All registration requests are added to the queue. This queue is processed once per second. After processing a request, the callback is executed and the registration result is passed in as a parameter.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template