Notifies clients of network events. Design Doc
This code is maintained by the Network Health and Configuration team. See also documentation for Network Diagnostic Routines and Network Health telemetry.
Clients interested in listening to network events may implement the NetworkEventsObserver Mojo interface, defined in network_health.mojom. The remote end of the NetworkEventsObserver interface must be added as an observer to the NetworkHealthService Mojo interface, also defined in network_health.mojom. Chrome clients can interact with the NetworkHealthService Mojo interface by using the global NetworkHealthService class. Note that Chrome OS clients may listen to network events through the cros_healthd daemon by adding a NetworkEventsObserver remote to cros_healthd. TODO(khegde): Replace CL with source once this lands.
See NetworkEventsObserver in network_health.mojom for available events.
The following is an example run that uses the cros-health-tool to listen for network events.
Ensure the active network is online. Then, start cros-health-tool:$cros-health-tool event --category=network --length_seconds=150
Disconnect the active network. Output:Network event received: Connection state changed, Network guid: fake-guid, Connection state: NetworkState::kNotConnected
Reconnect the active network. Output:Network event received: Connection state changed, Network guid: fake-guid, Connection state: NetworkState::kConnectingNetwork event received: Signal strength changed, Network guid: fake-guid, Signal strength: 60Network event received: Connection state changed, Network guid: fake-guid, Connection state: NetworkState::kConnectedNetwork event received: Connection state changed, Network guid: fake-guid, Connection state: NetworkState::kOnline
Move the device to a region with weaker signal strength. Output:Network event received: Signal strength changed, Network guid: fake-guid, Signal strength: 48