I am trying to find the right (or best) solution to the following question:
Say, I have a Google map (this is not exactly what kind of map) where people can create and delete markers, any user can see on the map, and I think about the class that the user now sees Know in So if someone else makes a marker on this class, then I will have to show it on the map immediately. For this I am going to use websockets but the question is not in the technical side, but the argument is about. What is the best way to send marker data to a user? Should I store the current boundaries of the location shown? I do not want to send new markers to all users because they do not need it, I just want to send people who see that class. Or am I the producer who is giving this information to the consumers?
Sorry if I have written misleading stuff, then ask me if nothing is clear. Thanks for your suggestions.
Keep track of the map borders of your existing connected users. When they pan the map, make sure that the server has been updated with these limits.
When a new point is added, on the server side, loop through each connection and check that the coordination is within those boundaries. If so, send the new marker.
Comments
Post a Comment