Entities
Entities are SDK objects that simplify PubNub APIs. Each entity gives you simple methods for channels, users, and metadata. This design helps you build real-time features fast.
Entities empower you to build sophisticated real-time features with less code.
Entity-enabled SDKs
Entities are supported in select SDKs. See your SDK’s API docs for details.
Entity types
Each server-side object has a matching SDK entity. Use these entities to run operations:
Entity | Provides operations on |
---|---|
Channel | Channels |
ChannelGroup | Channel groups |
UserMetadata | User metadata |
ChannelMetadata | Channel metadata |
Create entities
Each SDK provides methods to create a specific entity. Create a Channel
entity, a ChannelGroup
entity, a UserMetadata
entity, or a ChannelMetadata
entity. For SDK-specific details, see the API docs for your platform (for example, JavaScript).
Entities and subscriptions
PubNub provides several sources of real-time updates. Entities are one of them.
Entities let you subscribe to that entity’s updates. Update types vary by entity. For more information, see Subscriptions.
Channel
entity
The Channel
entity manages PubNub channels.
Supported operation | Description |
---|---|
subscription(subscriptionOptions) | Returns a local subscription object with optional parameters. Subscribe to get real-time updates. |
publish(message, shouldStore, meta, queryParam, usePost, ttl, customMessageType) Java and Kotlin SDKs only | Publishes a message to a channel. |
fire(message, meta, usePost) Java and Kotlin SDKs only | Sends a message to Illuminate and Functions event handlers registered on the channel and triggers their execution. |
signal(message, meta, usePost) Java and Kotlin SDKs only | Sends a signal to all subscribers of a channel. |
For SDK-specific details, see the API docs for your platform (for example, JavaScript).
ChannelGroup
entity
The ChannelGroup
entity provides operations performed on PubNub channel groups. A channel group is a set of channels. Use it for bulk actions, simple hierarchies, and easier access control that scales.
Supported operation | Description |
---|---|
subscription(subscriptionOptions) | Returns a local subscription object with optional parameters. Subscribe to get real-time updates. |
For SDK-specific details, see the API docs for your platform (for example, JavaScript).
UserMetadata
entity
The UserMetadata
entity lets you work with App Context user metadata.
Supported operation | Description |
---|---|
subscription(subscriptionOptions) | Returns a local subscription object with optional parameters. Subscribe to get real-time updates. |
For SDK-specific details, see the API docs for your platform (for example, JavaScript).
ChannelMetadata
entity
The ChannelMetadata
entity lets you work with App Context channel metadata.
Supported operation | Description |
---|---|
subscription(subscriptionOptions) | Returns a local subscription object with optional parameters. Subscribe to get real-time updates. |
For SDK-specific details, see the API docs for your platform (for example, JavaScript).