
com.pubnub.internal.v2.entities.BaseChannelMetadataImpl.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pubnub-core-impl Show documentation
Show all versions of pubnub-core-impl 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.internal.v2.entities
import com.pubnub.api.v2.callbacks.BaseEventListener
import com.pubnub.api.v2.entities.BaseChannelMetadata
import com.pubnub.api.v2.subscriptions.BaseSubscription
import com.pubnub.api.v2.subscriptions.SubscriptionOptions
import com.pubnub.internal.PubNubCore
import com.pubnub.internal.SubscriptionFactory
open class BaseChannelMetadataImpl>(
internal val pubnub: PubNubCore,
val channelName: ChannelName,
private val subscriptionFactory: SubscriptionFactory,
) : BaseChannelMetadata {
override val id: String = channelName.id
override fun subscription(options: SubscriptionOptions): Sub {
val channels = setOf(channelName)
return subscriptionFactory(
channels,
emptySet(),
SubscriptionOptions.filter { result ->
// simple channel name or presence channel
channels.any { it.id == result.channel }
} + options,
)
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
if (other !is BaseChannelMetadataImpl<*, *>) {
return false
}
if (pubnub != other.pubnub) {
return false
}
if (id != other.id) {
return false
}
return true
}
override fun hashCode(): Int {
var result = pubnub.hashCode()
result = 31 * result + id.hashCode()
return result
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy