Open dgatto opened 3 years ago
updatePins
event is sent out to all listeners with the app currently open. if their app isn't open at that moment, there's no point in sending them that event.
appIsClosed
, and if any clients have that event tracked recently then they do not get new updatePins
events sent.appIsClosed
approach seems like it could be easily error prone?disconnect
event is sent.updatePins
event, it will send a getPins
event to the server, requesting all pins within the lat/lng of the (viewport??, or should it be an inputted zipcode).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.
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?
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:
ionViewDidEnter
) it kicks off a request for pins of the lat/lng of provided location.