Answer the question
In order to leave comments, you need to log in
How to have constantly up-to-date data?
In general, there is a task ahead of me, and I don’t know how best to implement the solution, since I have never done this before.
Task:
An array with 10,000 objects comes from the server, the objects contain coordinates. I display these coordinates immediately on google maps (shows 10,000 elements within a radius of one block). Also, if the user moves, then some coordinates in the array change.
In general, the question is:
How to constantly have up-to-date data? Backend developers suggest shooting api every minute. Can this be simplified somehow?
Will working with such a volume of data (10,000) affect performance? (Won't it be buggy in simple words?)
It is also necessary for the application to work in the background. That is, when the coordinates change, it sends the user a notification about new objects.
Can this be done in react native?
If anything, backend in PHP.
Answer the question
In order to leave comments, you need to log in
For this, websockets and the message broker pattern for backing are used. For example, implemented using the rabbitmq lib for php.
The front subscribes to updates via sockets, the back sends notifications about new objects, and when a message is received, the front updates its data.
10000k flat objects is not much, but if there is a complex nested structure with a large number of fields and you perform some expensive operations on objects, then it will lag if you do not process them in the background.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question