Amplify has a local eventing system called Hub. It is a lightweight implementation of Publisher-Subscriber pattern, and is used to share data between modules and components in your app. Amplify uses Hub for different categories to communicate with one another when specific events occur, such as authentication events like a user sign-in or notification of a file download.

## Working with the API

### Listening for messages

import android0 from "/src/fragments/lib-v1/utilities/android/hub/10_listen_start.mdx";

<Fragments fragments={{android: android0}} />

import ios1 from "/src/fragments/lib-v1/utilities/ios/hub/10_listen_start.mdx";

<Fragments fragments={{ios: ios1}} />

import android2 from "/src/fragments/lib-v1/auth/android/hub_events/10_listen_events.mdx";

<Fragments fragments={{android: android2}} />

import ios3 from "/src/fragments/lib-v1/auth/ios/hub_events/10_listen_events.mdx";

<Fragments fragments={{ios: ios3}} />

### Stop Listening

import android4 from "/src/fragments/lib-v1/utilities/android/hub/20_listen_stop.mdx";

<Fragments fragments={{android: android4}} />

import ios5 from "/src/fragments/lib-v1/utilities/ios/hub/20_listen_stop.mdx";

<Fragments fragments={{ios: ios5}} />
