I have an idea for a part of my app but I'm not sure on the best way to do it logically. So the basic idea is I was 3 people that are using the app to appear on each of their screens. So they open the app, a map view appears and 3 of their friends have appeared moving on the map in real time IF they are within a radius of say 5km.
A better way to explain this is to imagine a school, and each kid had the app open, the teacher could see where every single kid was in real time as they are all within a radius of 5km.
My first instinct was to just get each user's current location and update that users lat and long in a database. And then every 3 seconds or so, every device will get ever user from their database and display a marker of their lat and long on the map. My main problem would be if there are 10k users in a database being updated every second, it might crash and have a lot of stress on it. Also, if it only shows users within a 5km radius of each other, would the best way be to do like an SQL query? so like get all users from user table where lat is +-5km of device location and same for long
That would be a square, not a radius but that's the only thing I can think of.
I'm pretty new to iOS development and I hear the best database is Firebase? I'm not sure if it's better to just use SQL though
If anyone could help me out on the logic behind this it would be greatly appreciated
Thank You :)