# onNavigationProgressChanged

Notification (Navigation and application).

Notification for changes in navigation progress

The main feedback channel during a journey. While BeNav is guiding, it pushes the state of the
drive to the client application, where the vehicle is, how far and how long to the destination and to
the next waypoint, current speed and speed limit, so the application can follow progress, show an
ETA to an end customer, or react to a delay without drawing a map itself.

The notification is off by default and is enabled with [`setupNotifications`](https://docs.benomad.com/benav-rnc/commands/setup-notifications.md), which also
sets how often it may arrive. It follows GPS updates, throttled to at most one every
`minPeriod` seconds.

**Worth knowing**

- `minPeriod` has a floor of 30 seconds; a lower value is raised to 30.
- Set `waypointsInfo` to receive the remaining via points as well as the destination.
  The destination itself is not repeated in that list: its figures are already in
  `distanceToDest` and `drivingDurationToDest`.
- The same payload can be requested on demand with [`getNavigationProgress`](https://docs.benomad.com/benav-rnc/commands/get-navigation-progress.md), which is
  the better choice when the client application needs a value at a moment of its own choosing rather
  than a stream.

## Configuration

```json
{
  "name":"onNavigationProgressChanged",
  "params": {
    "enabled": true,
    "minPeriod": 60,
    "waypointsInfo": true
  }
}
```

- `minPeriod`: limits the notification's frequency by adding a minimum notifications period in seconds.

  The notification triggers when the GPS position of the user is updated, but never more often than once every `minPeriod` seconds. Values below 30 are raised to 30.
- `waypointsInfo` If enabled, the notification also returns the remaining **via points**. The destination is **not** included - its figures are already in `distanceToDest` / `drivingDurationToDest`. On the final leg the `waypoints` field is omitted entirely rather than sent as an empty array.

## Notification Data

Example of notification:

```json
{
    "jsonrpc": "2.0",
    "method": "onNavigationProgressChanged",
    "params": {
        "currentMapMatchedHeading": -132.671875,
        "currentMapMatchedPosition": {
            "lat": 43.68879592504507,
            "lon": 7.241356387567606
        },
        "currentRouteInstructionIndex": 0,
        "currentRouteSectionIndex": 4,
        "currentSpeed": 37.54004,
        "currentSpeedLimit": 50.0,
        "distanceToDest": 20961.0,
        "distanceToNextInstruction": 1146.0,
        "distanceToNextWaypoint": 4774.0,
        "drivingDurationToDest": 3833,
        "durationToNextInstruction": 197,
        "durationToNextWaypoint": 790,
        "nextWaypointIndex": 1,
        "state": "ON_ROUTE",
        "totalDistance": 21188,
        "totalDrivingTime": 3865,
        "waypoints": [
            {
                "drivingDistance": 5001.0,
                "drivingDuration": 811.0
            },
            {
                "drivingDistance": 9067.0,
                "drivingDuration": 1457.0
            },
            {
                "drivingDistance": 11653.0,
                "drivingDuration": 2376.0
            },
            {
                "drivingDistance": 16072.0,
                "drivingDuration": 3196.0
            }
        ]
    }
}
```
