device topic.
nerves_hub_link sends and handles all of these events automatically on standard Nerves devices. This reference is for custom client implementations, alternative runtimes, or debugging unexpected channel behaviour.Server → Device Events
These events are pushed by NervesHub to a connected device. Your client must handle each event and respond appropriately.update
The server has determined that a firmware update is available for this device. The payload contains the firmware download URL and metadata needed to validate and apply the update.
reboot
The server is requesting that the device perform a graceful reboot. The payload is an empty object.
rebooting event back to the server, then initiate a system reboot. This event is typically triggered from the NervesHub web console or via the management API.
phx_err
The Phoenix channel encountered an error, such as a duplicate join attempt or an unexpected channel crash. The server pushes this event before the channel is terminated.
When your client receives
phx_err, tear down the current channel state and reconnect with exponential backoff.
phx_close
The Phoenix channel was gracefully closed by the server. The payload is an empty object.
Device → Server Events
These events are sent from the device to the NervesHub server. Send them in response to server events or to report ongoing status.rebooting
The device notifies the server that it is about to reboot. Send this event after receiving a reboot command from the server, before initiating the system reboot.
fwup_progress
The device reports its current firmware update download and write progress. Send this event periodically during a firmware update so the server and management console can display real-time progress.
status_update
The device reports its current operational status. Send this event when the device’s state changes — for example, when a firmware update fails or is deferred.
Accepted
status values:
Channel Lifecycle Summary
The sequence of events for a typical firmware update flow looks like this:1
Device connects and joins the channel
The device establishes a WebSocket connection and sends
phx_join with device_api_version.2
Server pushes an update event
NervesHub sends an
update event with firmware_url and firmware_meta.3
Device downloads and applies the firmware
The device streams progress via
fwup_progress events (value 0 → 100).4
Device signals reboot
On successful application, the device sends a
rebooting event, then reboots.5
Device reconnects on new firmware
After rebooting into the new firmware version, the device reconnects and rejoins the channel. NervesHub records the updated firmware version.
status_update event with status: "fwup_error" or status: "update_failed" so NervesHub can record the failure. Repeated failures put the device in the penalty box, and once a group’s fleet-wide failure threshold is crossed the group is flagged unhealthy.
