---
source_url: https://www.pubnub.com/docs/general/push/send
title: Push Basics
updated_at: 2026-05-19T12:11:07.477Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Push Basics

In-app messaging is powerful but you also may need Mobile Push Notifications. This feature delivers messages fast and reliably, whether the app is in the foreground or background on iOS and Android.

##### Beware! Your base is being captured!

Hi! I’m Sarah - a Staff Software Engineer by day and a passionate gamer by night. I work at Indie Game Studio, where my team and I try to be the best in mobile gaming. Recently, we had the challenge of building an RTS game that would allow globally-distributed players to communicate in real time & stay up to date day and night. For that, we had to deliver a scalable in-game chat for live battles where players team up to form guilds and fight each other for resources and territory. We also wanted to keep the players engaged with mobile notifications for individual players (like “Rivals are conquering your land!”) and group broadcasts (“A new player is joining your guild”). However, we knew little about building a scalable chat with updates and didn’t have much time to do that either as we were busy designing maps and units.

We came across PubNub and immediately fell for it. PubNub offers a scalable, flexible tech stack with over [50 SDKs](https://www.pubnub.com/docs/sdks), including mobile support. Its primary use case is [chat](https://www.pubnub.com/solutions/chat/), so we knew immediately we were in good hands. PubNub also supports mobile push notifications for [iOS](https://www.pubnub.com/docs/general/push/ios) and [Android](https://www.pubnub.com/docs/general/push/android) devices by offering integrations with third-party push notification services, including Firebase Cloud Messaging (FCM) and Apple Push Notification Service (APNs).

With PubNub at hand, game hosts could finally organize global weekly battles where players from all over the globe would come to win new resources or grow their in-game empire. These mass chats scale as expected and in case of any issues, there are [troubleshooting guidelines](https://www.pubnub.com/docs/general/push/mobile-push-troubleshooting) and [support](https://www.pubnub.com/docs/mailto:support@pubnub.com) to fall back to. Thanks to real-time updates, hosts noticed a significant increase in player engagement and retention. Players no longer fear missing out and can control their battlefield—even when someone might capture a base at any time.

PubNub's Mobile Push Notifications bridges native PubNub publishing with third‑party push services, including Firebase Cloud Messaging (FCM) and Apple Push Notification Service (APNs). The push gateway lets you send important data and messages even when users are not active in your mobile app.

:::note Pricing
Push notification transactions are included in PubNub’s Monthly Active Users (MAU) pricing model. For more information, visit our [Pricing](https://www.pubnub.com/pricing/) page.
:::

## How it works

After you enable Mobile Push Notifications, associate device tokens with PubNub channel names. When you publish to a channel, PubNub looks up registered tokens and forwards the push request to FCM or APNs for those devices. Behind the scenes, the feature establishes an authenticated connection to the providers based on your configuration.

Push notifications are delivered in the following manner:

1. First, publish a message on a channel with the push payload.
2. PubNub's Push Gateway checks device registrations and relays the message to push providers.
3. FCM/APNs providers deliver the push notification to one or more devices.

![Push Notification Delivery](https://www.pubnub.com/assets/images/push-runtime-ec3bff5b5d7691e0ffb416358b6a2f21.png)

###### Trigger push notifications from published messages

Every push notification starts as a [published message](https://www.pubnub.com/docs/general/messages/publish) that includes a push payload. PubNub's gateway inspects published messages for push-specific keys and forwards them to FCM or APNs. This means push notifications inherit the same channel routing, [Access Manager permissions](https://www.pubnub.com/docs/general/security/access-control), and [message type](https://www.pubnub.com/docs/general/messages/type) conventions as regular messages. [File messages](https://www.pubnub.com/docs/general/files) can also trigger push notifications when a push payload is included at send time. When a user connects from [multiple devices](https://www.pubnub.com/docs/general/setup/users-and-devices#multiple-devices-per-user) with the same User ID, exclude all of their device tokens to prevent self-notifications across every device.

## Configuration

Enable and configure Mobile Push Notifications on your app's keyset in the [Admin Portal](https://admin.pubnub.com/).

:::tip Public Admin Portal demo
Want to browse through the Admin Portal without creating an account? Explore it through the [Public Demo](https://demo-admin.pubnub.com/) that shows examples of most PubNub features for transport and logistics use case.
:::

![Mobile Push Notifications in Admin Portal](https://www.pubnub.com/assets/images/push-notifications-85921229869a8b3aa72d7d0fa4cb2836.png)

| Option | Description |
| --- | --- |
| **Firebase Cloud Messaging** | Connection details for [FCM](https://firebase.google.com/docs/cloud-messaging) when you use it as a push service provider to deliver push notifications to your application. |
| → **Private key file** | Private key file downloaded from FCM. |
| **Apple Push Credentials** | Connection details for [APNs](https://developer.apple.com/documentation/usernotifications/sending-notification-requests-to-apns) when you use it as a push service provider to deliver push notifications to your application. |
| → **Team ID** | 10-character string generated by [Apple](https://developer.apple.com/help/account/manage-your-team/locate-your-team-id/) that’s assigned to your team. |
| → **Auth Key ID** | 10-character [key identifier](https://developer.apple.com/documentation/usernotifications/establishing-a-token-based-connection-to-apns) generated by Apple. |
| → **Token file** | Apple's authentication token signing key, like `AuthKey_678PB6YGZ.p8`. |

Set up FCM/APNs credentials for your application. After you obtain credentials from Apple or Firebase, add them or upload a certificate in the [Admin Portal](https://admin.pubnub.com/).

![Push Register](https://www.pubnub.com/assets/images/push-register-8a385f5f2f3e0618441770033486c621.png)

## Register devices

Register the device token (provided by the platform) with one or more PubNub channels. You can update registrations any time by adding channels or removing previously registered channels. This lets you curate channel‑specific messages and change targeted device lists in real time.

:::note Registration scope
Mobile Push registration works with individual channels. Channel groups aren’t supported for registering devices or targeting Mobile Push Notifications. To target a set of channels, register the device token on each channel.
:::

## Send notifications

Include APNs, FCM, or both payloads when you publish a message. When PubNub finds `pn_apns` and `pn_fcm`, it retrieves device tokens registered on the target channel and forwards the push request to the appropriate provider.

* [Create an APNs payload](https://www.pubnub.com/docs/general/push/ios#step-5-construct-the-push-payload)
* [Create an FCM payload](https://www.pubnub.com/docs/general/push/android#step-5-construct-the-push-payload)

### Prevent self-notifications

When a user sends a message and then quickly backgrounds the app, they can receive a push notification for their own message. To prevent this, exclude the sender’s device token(s) in the push payload on each publish where you don’t want the sender to get a push.

* APNs: add the sender’s token to [pn_apns.pn_push[].targets[].excluded_devices](/docs/general/push/ios#prevent-self-notifications).
* FCM: add the sender’s token to [pn_fcm.pn_exceptions](https://www.pubnub.com/docs/general/push/android#prevent-self-notifications).

If a user has multiple devices, include all of their device tokens so none of those devices receive the push. Users actively subscribed to the channel will still receive the real-time message; add client-side de-duplication if needed.

## Receive notifications

After the PubNub Push Gateway forwards the request to APNs or FCM, those providers deliver notifications to devices. The push providers handle device delivery.

If the user is active in the app, the user receives the in‑app message via PubNub subscription, and a push may be unnecessary. Use platform APIs to mute the push notification instead of muting the real‑time message.

## Troubleshooting

You can debug push notification issues by inspecting the messages published to a `{channelName}-pndebug` channel. For example, if you publish a message on channel `ch1`, the corresponding debug channel is `ch1-pndebug`. You can subscribe to a debug channel using the [PubNub Debug Console](https://www.pubnub.com/docs/console/) to troubleshoot push errors like invalid device tokens or invalid push payload.

For more information about push troubleshooting, refer to [Mobile Push Troubleshooting](https://www.pubnub.com/docs/general/push/mobile-push-troubleshooting).