cafe-for-cats / mobile

client-side code for the project 📱
1 stars 0 forks source link

Refresh pins for users upon new add #63

Open dgatto opened 3 years ago

dgatto commented 3 years ago

We could either do refreshes based on zip codes, or based on the viewport. the users could give a zip code and then we do one request for that area, or we do it based on viewport and it would most likely work like below:

dgatto commented 3 years ago
dgatto commented 3 years ago

We should probably do everything based on the provided location from the user. Although, if they zoom out too far, then they should get a notification saying "hey, you've zoomed out a lot, provide a new location."

We could do viewport based, grab lat/lng and query based on that, but the logic would be a large amount of effort to take on. Maybe something to keep as a stretch item.

dgatto commented 3 years ago

So upon adding a pin, updatePins event is sent out to all listeners with a matching zip code.

Here's how we'll store clients in node:

new Client = {
    socketId: ObjectId,
    zipCode: string
}

If a client's zip code matches the zip code of the pin just added, emit a getPins(zipCode) event to them.

possibly store the clients in zip-code based dictionaries so i already know which ones to update?