Channel SDK entity

As of version 9.0.0, the Kotlin software development kit (SDK) supports SDK entities. SDK entities are local objects that bundle operations for a specific resource type and simplify working with PubNub application programming interfaces (APIs).

Use SDK entities to perform common tasks without manually wiring requests. Some PubNub APIs are exposed via SDK entities. Other operations remain available on the pubnub object.

Create a Channel​

Use this factory method to return a local Channel SDK entity for a single channel. A Channel SDK entity centralizes common operations—such as subscribing and publishing—so you can prototype and build faster.

1pubnub.channel(name: String): Channel
* required
ParameterDescription
name *
Type: String
Name of the channel for which to create the SDK entity.

Sample code​

Reference code
This example is a self-contained code snippet ready to be run. It includes necessary imports and executes methods with console logging. Use it as a reference when working with other examples in this document.
1

Available operations​

The Channel SDK entity provides operations for PubNub channels.

Operation (click for more information)Description
subscription(subscriptionOptions)Returns a local channel subscription object with optional parameters. You can then subscribe to receive real-time updates for that channel.
publish(message, shouldStore, meta, queryParam, usePost, ttl)Sends a message to all channel subscribers.
fire(message, meta, usePost)Sends a message to Illuminate and Functions event handlers registered on the channel and triggers their execution.
signal(message, meta, usePost)Sends a signal to all subscribers of the channel.

Was this page useful?

Last updated on