
com.pubnub.internal.endpoints.TimeEndpoint.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pubnub-kotlin-impl Show documentation
Show all versions of pubnub-kotlin-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.endpoints
import com.pubnub.api.endpoints.Time
import com.pubnub.api.enums.PNOperationType
import com.pubnub.api.models.consumer.PNTimeResult
import com.pubnub.api.retry.RetryableEndpointGroup
import com.pubnub.internal.EndpointCore
import com.pubnub.internal.PubNubImpl
import retrofit2.Response
/**
* @see [PubNubImpl.time]
*/
class TimeEndpoint(pubnub: PubNubImpl, private val excludeFromRetry: Boolean = false) :
EndpointCore, PNTimeResult>(pubnub),
Time {
override fun getAffectedChannels() = emptyList()
override fun getAffectedChannelGroups() = emptyList()
override fun doWork(queryParams: HashMap) = retrofitManager.timeService.fetchTime(queryParams)
override fun createResponse(input: Response>): PNTimeResult {
return PNTimeResult(input.body()!![0])
}
override fun operationType() = PNOperationType.PNTimeOperation
override fun isAuthRequired() = false
override fun isSubKeyRequired() = false
override fun getEndpointGroupName(): RetryableEndpointGroup = RetryableEndpointGroup.MESSAGE_PERSISTENCE
// it is excluded here because retry in old subscribeLoop uses it to check connectivity
override fun isEndpointRetryable(): Boolean = !excludeFromRetry
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy