observe Route Changes
Observes route changes for a specific route with real-time updates.
This method provides a reactive stream of route changes including:
Route Details: Real-time updates to route content and metadata
Route Deletion: When route is deleted on server
Access Changes: When route becomes inaccessible
Offline-First Behavior:
Background Sync Trigger: Only emits events during background delta sync operations
Initial Sync Exclusion: Does NOT trigger during initial route fetching to avoid unnecessary events
Cached Data Updates: Emits when existing cached route data is updated from server
Usage Pattern:
zync.routes.observeRouteChanges(routeUid).collect { event ->
when (event) {
is ZyncRouteUpdateEvent.RouteUpdated -> {
// Handle route update - route data changed on server
println("Route updated: ${event.routeUid}")
}
is ZyncRouteUpdateEvent.RouteDeleted -> {
// Handle route deletion - route was deleted on server
println("Route deleted: ${event.routeUid}")
}
is ZyncRouteUpdateEvent.RouteNotAccessible -> {
// Handle access revoked - user no longer has access
println("Route not accessible: ${event.routeUid}")
}
}
}Content copied to clipboard
Return
Flow of ZyncRouteUpdateEvent containing changes to route data
Parameters
route Uid
Unique identifier of the route to observe