Presence Management

When you enable Presence on your app's keyset in the Admin Portal, you start tracking Presence for all channels on your keyset. This means that you can monitor channel members' subscription status, track any Presence-related events, for example, when users join or leave the channel, or when their presence state changes.

Subscription with Presence

You must create a subscription with Presence enabled to receive Presence events. For more information, refer to each SDK's Publish and Subscribe documentation.

If you don't want to track Presence events on all your channels but only on the selected ones, you can do that using Presence Management.

Presence Management is a self-service tool that lets you create rules defining which Presence events you want to track on which channel patterns.

Existing Presence rules

If you already have Presence rules created by PubNub support, they remain valid and will be visible on the Admin Portal.

To start managing presence rules, follow these steps:

  1. Log into the Admin Portal.
  2. Go to the BizOps Workspace section in the left navigation panel.
  3. Select Presence Management.
  4. Choose an app and a keyset on which you want to manage channels.
  5. If needed, configure your keyset following on-screen instructions.

Create Presence rules

Requires Presence

To create Presence rules for channels, you must enable Presence for your app's keyset in the Admin Portal.

  1. Once in the Presence Management module of BizOps Workspace, click the Create Rule button.

    Create rule

  2. Select the Publish Client Events you want to track. When you're done, click Next.

    EventsUI representationDescription
    joinJFires when a user subscribes to a channel.
    leaveLFires when a user unsubscribes from a channel.
    timeoutTFires when a connection to a channel is lost and the subscriber hasn't been seen in 300 seconds.
    state-changeSFires whenever the user's state changes.
    intervalIFires in interval mode to provide an occupancy count and optionally include delta changes.
  3. Type in the wildcard pattern for the channels you want to enable Presence on. For example, enter personal-* to track Presence on all channels with the personal prefix. Mark the This pattern is for channel groups checkbox if you also want to apply the rule to the channel groups. When you're ready, click Next.

    Rule limitations

    If you want to include a few patterns, you must create additional rules as one rule can follow only one allowlist pattern.

  4. At the end, you'll see the rule configuration summary. Click Create to finish.

    The new rule will appear on the rules list.

    Presence rule

Change rules order

Each rule created through Presence Management gets a unique number that denotes the rule execution sequence, with new rules taking precedence over the older rules.

You can change the order of rules by hovering over a given rule and moving it up or down the list.

Rules order

Edit rules

To edit a rule, click the "More" option next to the rule, select Edit, and confirm your choice.

Edit rule

Delete rules

To delete a rule, click the "More" option next to the rule, select Delete, and confirm your choice.

Delete rule

Configure webhooks for rules

Once you have created Presence rules, you can configure webhooks for them using Events & Actions. This way, you can decide what will happen when chosen Presence events occur. For example, you can configure Events & Actions to send e-mail notifications each time a new member joins a channel.

Last updated on