<!-- Source: @site/projects/frontline-api-for-laravel/docs/13-protocol.md -->
<!-- Canonical: https://docs.pushery.com/frontline-api-for-laravel/protocol/ -->

# Upgrading the protocol

> The protocol version the package writes and reads, the order in which the gateways and the package move to a new one, and what the status shows while the two differ.

Every sheet, every heartbeat and every meter batch carries the version of the protocol it is written
in. This release of the package writes and reads version 1. A gateway reads the current version and
the one before it, and writes what it sends back, its meter batches and its report, in the version
of the newest heartbeat it accepted from your application.

## The order of an upgrade

When a release moves the protocol to a new version, the gateways move first and the package second:

1. Upgrade every gateway of the product to the release that reads the new version beside the old
   one.
2. Check that each of them does: `php artisan frontline:status` lists, per gateway, the protocol
   versions it reads.
3. Upgrade the package. From its next publication on, the sheets and the heartbeat carry the new
   version, and each gateway writes its counts and its report in it once it has accepted that
   heartbeat.

In this order nothing is lost. At every step the gateways read what the package writes, and the
package reads what the gateways write, since they follow the version of its heartbeat.

## While the versions differ

A meter batch in a version the package does not read is discarded and never counted. The
`frontline_meter_reads` table records how many entries were discarded, with the time and the reason
of the last one, and the `meter` health check warns for 24 hours after it. A gateway's report in a
version the package does not read makes the `sheets` check warn
([Status and health](https://docs.pushery.com/frontline-api-for-laravel/status-and-health.md)).
