Send typed broadcast updates for survey, job, and LOI writes - #2588
Open
rfontanarosa wants to merge 6 commits into
Open
Send typed broadcast updates for survey, job, and LOI writes#2588rfontanarosa wants to merge 6 commits into
rfontanarosa wants to merge 6 commits into
Conversation
Replace the generic empty-payload broadcastSurveyUpdate() with a single
broadcastUpdate() that tags each FCM message with a type ('survey', 'job',
or 'loi'), the affected entity id, and the triggering event's commit time.
LOI updates also carry a deleted flag. Clients that don't inspect the
payload keep working exactly as before (full survey resync); clients that
do can use the hint to fetch just what changed instead of resyncing
everything.
Messages still share one collapse key per survey so bursts of writes (e.g.
importing LOIs) collapse into a single wake-up.
Collaborator
|
I see we opted to stick with hard-delete via FCM (push) rather than soft delete + pull? What happens if many entites are deleted (e.g. an entire survey)? Wouldn't clients get flooded with messages? Same question on batch create and write - is there a way to debounce the create and write update messages? |
# Conflicts: # functions/src/on-create-loi.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
part of #2580
Summary
broadcastSurveyUpdate()with a typedbroadcastUpdate()sent from the survey, job, and LOI write triggers.type(survey|job|loi), the affected entity's id, and the triggering event's commit time (eventTime); LOI updates also carrydeleted.Compatibility
Verified against
ground-android:FirebaseMessagingService.onMessageReceived()only readsremoteMessage.from(the topic) to decide which survey to resync, and never inspectsremoteMessage.data. The added fields are additive and ignored by the current app, so existing clients keep doing a full resync exactly as before. Newer clients can use the type/id hints to sync just what changed.