All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pubnub.api.builder.PubSub.kt Maven / Gradle / Ivy

Go to download

PubNub is a cross-platform client-to-client (1:1 and 1:many) push service in the cloud, capable of broadcasting real-time messages to millions of web and mobile clients simultaneously, in less than a quarter second!

There is a newer version: 10.2.0
Show newest version
package com.pubnub.api.builder

import com.pubnub.api.PubNub
import com.pubnub.api.managers.SubscriptionManager

object PubSub {
    /**
     * @see [PubNub.presence]
     */
    internal fun presence(
        subscriptionManager: SubscriptionManager,
        channels: List = emptyList(),
        channelGroups: List = emptyList(),
        connected: Boolean = false
    ) {
        val presenceOperation = PresenceOperation(
            connected = connected,
            channels = channels,
            channelGroups = channelGroups
        )
        subscriptionManager.adaptPresenceBuilder(presenceOperation)
    }

    /**
     * @see [PubNub.subscribe]
     */
    internal fun subscribe(
        subscriptionManager: SubscriptionManager,
        channels: List = emptyList(),
        channelGroups: List = emptyList(),
        withPresence: Boolean = false,
        withTimetoken: Long = 0L
    ) {

        val subscribeOperation = SubscribeOperation(
            channels = channels,
            channelGroups = channelGroups,
            presenceEnabled = withPresence,
            timetoken = withTimetoken
        )
        subscriptionManager.adaptSubscribeBuilder(subscribeOperation)
    }

    /**
     * @see [PubNub.unsubscribe]
     */
    internal fun unsubscribe(
        subscriptionManager: SubscriptionManager,
        channels: List = emptyList(),
        channelGroups: List = emptyList()
    ) {
        val unsubscribeOperation = UnsubscribeOperation(
            channels = channels,
            channelGroups = channelGroups
        )
        subscriptionManager.adaptUnsubscribeBuilder(unsubscribeOperation)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy