Entities
Entities are SDK objects that provide operations on endpoints associated with their entity type. They are designed as first-class citizens to facilitate working with various PubNub APIs.
Entity-enabled SDKs
Not all PubNub SDKs currently support entities. Refer to each SDK's API documentation for more information.
Entity types
Particular abstract server-side objects have their corresponding SDK entities, allowing you to perform different operations:
Entity | Provides operations on |
---|---|
Channel | Channels |
ChannelGroup | Channel groups |
UserMetadata | User metadata |
ChannelMetadata | Channel metadata |
Create entities
Each SDK has dedicated methods to create each entity instance. For more information on creating entities, refer to each SDK's Entities section of the API documentation, for example, JavaScript.
Entities and subscriptions
There are a few sources of real-time updates in PubNub SDKs that provide different levels of granularity, entities being one of them.
Entities allow you to create subscriptions to receive all real-time updates associated with that particular entity. The type of received updates is different for each entity type. For more information, refer to Subscriptions.
The available entity types include:
Channel
entity
The Channel
entity provides operations performed on PubNub channels.
Supported operation | Description |
---|---|
subscription(subscriptionOptions) | Returns a local channel subscription object with optional parameters to which you can subscribe and start receiving real-time updates for that channel. |
For more information on working with entities in each SDK, refer to the SDK's API documentation, for example, in JavaScript.
ChannelGroup
entity
The ChannelGroup
entity provides operations performed on PubNub channel groups.
Supported operation | Description |
---|---|
subscription(subscriptionOptions) | Returns a local channel group subscription object with optional parameters to which you can subscribe and start receiving real-time updates for that channel group. |
For more information on working with entities in each SDK, refer to the SDK's API documentation, for example, in JavaScript.
UserMetadata
entity
The UserMetadata
entity provides operations performed on PubNub App Context's user metadata.
Supported operation | Description |
---|---|
subscription(subscriptionOptions) | Returns a local user metadata subscription object with optional parameters to which you can subscribe and start receiving real-time updates for that user. |
For more information on working with entities in each SDK, refer to the SDK's API documentation, for example, in JavaScript.
ChannelMetadata
entity
The ChannelMetadata
entity provides operations performed on PubNub App Context's channel metadata.
Supported operation | Description |
---|---|
subscription(subscriptionOptions) | Returns a local channel metadata subscription object with optional parameters to which you can subscribe and start receiving real-time updates for that channel. |
For more information on working with entities in each SDK, refer to the SDK's API documentation, for example, in JavaScript.