Open derhuerst opened 4 years ago
Some comments from the draft Google doc:
Finally, the consumer should ensure that updates received together in a single
FeedMessage
become visible to an end user simultaneously. The user should never observe a state where some updates in aFeedMessage
have been applied but others have not.The GTFS-RT reference document states that the
FeedEntity.id
andFeedEntity.isDeleted
fields are only relevant to incremental feeds. However, given the differential semantics outlined above there is not a clear need to explicitly delete RT messages (other thanAlert
s, see discussion below) as one can always simply provide an update that will supersede them.
TripUpdate
s: Both scheduled and added trips can beCANCELED
by sending anotherTripUpdate
message referencing the same trip ID.VehiclePosition
s: When a message is received saying the vehicle isSTOPPED_AT
the last stop in a trip, or saying that a vehicle has moved on to a different trip, its state with respect to that first trip is effectively removed. However, it might be helpful to provide a means to unambiguously signal that a vehicle has gone out of service.Alert
s. Unlike the other two message types, multipleAlert
s may accumulate to the same GTFS entity. Without alert IDs and deletion flags, it would not be possible to remove them in differential mode. We can completely sidestep the problem by simply not using differentialAlert
s.Alert
datasets are generally small and do not benefit greatly from low update latency. They seem to be a good use case for theFULL_DATASET
provider push combination.
I think these steps must be implemented for full compatibility:
FeedMessage
s instead of FeedEntity
sTripUpdate
entities using DELETED
VehiclePosition
entities using STOPPED_AT
ttl: Infinity
lib/entities-store
: respect FeedMessage.header.timestamp
when setting the expiry timer?good to know:
- Differential vs. Incremental. The reference and specification use both terms: differential and incremental. We should choose only one and use it consistently. These same terms are used in backup systems, and the behavior here seems closer to incremental backups where only individual files that have changed since the last backup (be it incremental, differential, or full) are included. In some sense, GTFS-RT as a whole is “differential” with respect to scheduled GTFS, and the new mode we are discussing is “incremental” with respect to a GTFS-RT
FULL_DATASET
.
The OTP docs also refer to this lib which implements the OTP-specific "GTFS-RT FeedEntity
s over WebSockets" style: https://github.com/OneBusAway/onebusaway-gtfs-realtime-exporter
https://transport.data.gouv.fr/explore displays a VehiclePosition
s from a feed on a map. It receives them via a custom WebSocket-based protocol:
We should carefully read the draft
DIFFERENTIAL
spec and make sure this package follow it. There are already too many homegrown almost-compatible GTFS-RT tools out there, this package shouldn't be another one!