What is App Context?
The App Context feature provides easy-to-use, serverless storage to store metadata for users, channels, and memberships without setting up your database. You can optionally store metadata, including custom properties, for your application users. PubNub triggers events when object data is set or removed from the database, which means that you can receive these events in real time and update your front-end application accordingly.
The Metadata API for PubNub can be used to get and set metadata for users, channels, channel memberships, and channel members. This API can also set the filtering language definition to filter for specific metadata in the database, and is similar to the stream filtering language.
Follow Along
Watch the video below or follow the step-by-step instructions to enable App Context in your PubNub keyset. Need extra information? You can also check out PubNub’s official documentation on App Context to learn more about how to implement App Context in your application.
Step-by-Step
Login to the Admin Portal.
Click on the apps tab on the left hand side of the portal.
Click on an application. You will be brought to the keysets page for this application.
Create a new keyset by clicking on the “Create New Keyset” button. You will be brought to the configuration page for this keyset.
Enable the App Context feature by clicking the slider.
The Region setting is the region where your objects are stored. Please note that the region cannot be modified after saving changes to the keyset.
If the User and Channel Metadata Events settings are enabled, the user and channel metadata events are triggered when user or channel metadata is set or removed in the objects database, respectively.
When the Membership Events setting is enabled, membership events are triggered when memberships are added, updated, or removed in the objects database.
The final two settings Disallow Get All Channel and User Metadata settings, do not allow the “Get All Channel/User Metadata” calls, if enabled, respectively.
These calls return a paginated list of channel/user metadata objects.
Click on Save Changes to save these updated changes.