com.pubnub.api.subscribe.eventengine.effect.effectprovider.HandshakeProviderImpl.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pubnub-kotlin Show documentation
Show all versions of pubnub-kotlin Show documentation
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!
package com.pubnub.api.subscribe.eventengine.effect.effectprovider
import com.pubnub.api.PubNub
import com.pubnub.api.endpoints.pubsub.Subscribe
import com.pubnub.api.endpoints.remoteaction.RemoteAction
import com.pubnub.api.endpoints.remoteaction.map
import com.pubnub.api.subscribe.eventengine.event.SubscriptionCursor
internal class HandshakeProviderImpl(val pubNub: PubNub) : HandshakeProvider {
override fun getHandshakeRemoteAction(
channels: Set,
channelGroups: Set
): RemoteAction {
val subscribe = Subscribe(pubNub)
subscribe.channels = channels.toList()
subscribe.channelGroups = channelGroups.toList()
subscribe.timetoken = 0
subscribe.region = null
return subscribe.map { SubscriptionCursor(it.metadata.timetoken, it.metadata.region) }
}
}