Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: kotlin
version: 10.5.5
version: 10.5.6
schema: 1
scm: github.com/pubnub/kotlin
files:
- build/libs/pubnub-kotlin-10.5.5-all.jar
- build/libs/pubnub-kotlin-10.5.6-all.jar
sdks:
-
type: library
Expand All @@ -23,8 +23,8 @@ sdks:
-
distribution-type: library
distribution-repository: maven
package-name: pubnub-kotlin-10.5.5
location: https://repo.maven.apache.org/maven2/com/pubnub/pubnub-kotlin/10.5.5/pubnub-kotlin-10.5.5.jar
package-name: pubnub-kotlin-10.5.6
location: https://repo.maven.apache.org/maven2/com/pubnub/pubnub-kotlin/10.5.6/pubnub-kotlin-10.5.6.jar
supported-platforms:
supported-operating-systems:
Android:
Expand Down Expand Up @@ -121,6 +121,11 @@ sdks:
license-url: https://www.apache.org/licenses/LICENSE-2.0.txt
is-required: Required
changelog:
- date: 2025-07-31
version: v10.5.6
changes:
- type: bug
text: "Internal change - enabled EE for JS target in KMP tests."
- date: 2025-07-30
version: v10.5.5
changes:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v10.5.6
July 31 2025

#### Fixed
- Internal change - enabled EE for JS target in KMP tests.

## v10.5.5
July 30 2025

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ You will need the publish and subscribe keys to authenticate your app. Get your
<dependency>
<groupId>com.pubnub</groupId>
<artifactId>pubnub-kotlin</artifactId>
<version>10.5.5</version>
<version>10.5.6</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RELEASE_SIGNING_ENABLED=true
SONATYPE_HOST=DEFAULT
SONATYPE_AUTOMATIC_RELEASE=false
GROUP=com.pubnub
VERSION_NAME=10.5.5
VERSION_NAME=10.5.6
POM_PACKAGING=jar

POM_NAME=PubNub SDK
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ktlint = "12.1.0"
dokka = "2.0.0"
kotlinx_datetime = "0.6.2"
kotlinx_coroutines = "1.10.2"
pubnub_js = "8.6.0"
pubnub_js = "9.8.1"
pubnub_swift = "9.3.0"

[libraries]
Expand Down
14 changes: 10 additions & 4 deletions kotlin-js-store/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ esutils@^2.0.2:
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64"
integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==

fflate@^0.8.2:
version "0.8.2"
resolved "https://registry.yarnpkg.com/fflate/-/fflate-0.8.2.tgz#fc8631f5347812ad6028bbe4a2308b2792aa1dea"
integrity sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==

fill-range@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
Expand Down Expand Up @@ -666,15 +671,16 @@ proxy-from-env@^1.1.0:
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==

pubnub@8.6.0:
version "8.6.0"
resolved "https://registry.yarnpkg.com/pubnub/-/pubnub-8.6.0.tgz#75524e7ed3653090652d160ce83ac089362a0379"
integrity sha512-LBCglooxiLkNT3ArUOvSJnLKK6/QdeshWY60IWlSQ+SkXlzEjt74wAnX5XriEXKsmza2yw9mFGG6+B5SlczRzA==
pubnub@9.8.1:
version "9.8.1"
resolved "https://registry.yarnpkg.com/pubnub/-/pubnub-9.8.1.tgz#b6b38b23469c18e632403661ef52b83a9058d63d"
integrity sha512-ZeBk6Wn09w1/XpTk388unm1cOZ7da6bZLqoTbh5cMolIwWsEHzvyDnVrk/oE9USxRYr6yeKu/KiLcnj2oG4+fQ==
dependencies:
agentkeepalive "^3.5.2"
buffer "^6.0.3"
cbor-js "^0.1.0"
cbor-sync "^1.0.4"
fflate "^0.8.2"
form-data "^4.0.0"
lil-uuid "^0.1.1"
node-fetch "^2.7.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package com.pubnub.test.integration

import com.pubnub.api.PubNubException
import com.pubnub.api.enums.PNStatusCategory
import com.pubnub.api.models.consumer.PNStatus
import com.pubnub.api.models.consumer.objects.PNPage
import com.pubnub.api.models.consumer.objects.channel.PNChannelMetadata
import com.pubnub.api.models.consumer.pubsub.objects.PNDeleteChannelMetadataEventMessage
import com.pubnub.api.models.consumer.pubsub.objects.PNObjectEventResult
import com.pubnub.api.models.consumer.pubsub.objects.PNSetChannelMetadataEventMessage
import com.pubnub.kmp.PLATFORM
import com.pubnub.kmp.createCustomObject
import com.pubnub.kmp.createStatusListener
import com.pubnub.kmp.readAllBytes
import com.pubnub.kmp.stringToUploadable
import com.pubnub.test.BaseIntegrationTest
Expand All @@ -22,6 +25,10 @@ import kotlin.test.assertNotNull
import kotlin.test.assertTrue
import kotlin.time.Duration.Companion.seconds

private const val PN_CONNECTED_CATEGORY = "PNConnectedCategory"

private const val PN_DISCONNECTED_CATEGORY = "PNDisconnectedCategory"

class ChannelMetadataTest : BaseIntegrationTest() {
private val channel = "myChannel" + randomString()
private val name = randomString()
Expand All @@ -32,6 +39,108 @@ class ChannelMetadataTest : BaseIntegrationTest() {
private val includeCustom = true
private val type = randomString()

@Test
fun test_disconnect() = runTest(timeout = 30.seconds) {
val channelName = "myChannel"
var disconnectStatus: PNStatus? = null

val statusListener = createStatusListener(pubnub) { _, status ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of the empty statusListener?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Current shape of the test is not intuitive.
nextStatus() is responsible for getting latest status.
I will fix that.

if (status.category == PNStatusCategory.PNDisconnectedCategory) {
disconnectStatus = status
}
}

pubnub.test(backgroundScope) {
try {
pubnub.addListener(statusListener)

val channel = pubnub.channel(channelName)
channel.subscription().subscribe()

// Wait for connection status
val connectStatus = nextStatus()
assertEquals(false, connectStatus.error)
assertEquals(PN_CONNECTED_CATEGORY, connectStatus.category.toString())

// Disconnect and wait for disconnect status
pubnub.disconnect()

// Wait for disconnect status using nextStatus() (from test infrastructure)
val disconnectStatusFromQueue = nextStatus()
assertEquals(false, disconnectStatusFromQueue.error)
assertEquals(PN_DISCONNECTED_CATEGORY, disconnectStatusFromQueue.category.toString())

// Verify our listener also captured the disconnect status
assertNotNull(disconnectStatus)
assertEquals(PN_DISCONNECTED_CATEGORY, disconnectStatus!!.category.toString())
} finally {
// Cleanup
pubnub.removeListener(statusListener)
}
}
}

@Test
fun test_reconnect() = runTest(timeout = 30.seconds) {
val channelName = "myChannel"
var disconnectStatus: PNStatus? = null
var reconnectStatus: PNStatus? = null

val statusListener = createStatusListener(pubnub) { _, status ->
when (status.category) {
PNStatusCategory.PNDisconnectedCategory -> {
disconnectStatus = status
}
PNStatusCategory.PNConnectedCategory -> {
// Only capture reconnect status (not initial connect)
if (disconnectStatus != null) {
reconnectStatus = status
}
}
else -> {
// Ignore other status categories
}
}
}

pubnub.test(backgroundScope) {
try {
pubnub.addListener(statusListener)

val channel = pubnub.channel(channelName)
channel.subscription().subscribe()

// Wait for connection status
val connectStatus = nextStatus()
assertEquals(false, connectStatus.error)
assertEquals(PN_CONNECTED_CATEGORY, connectStatus.category.toString())

// Disconnect and wait for disconnect status
pubnub.disconnect()

val disconnectStatusFromQueue = nextStatus()
assertEquals(false, disconnectStatusFromQueue.error)
assertEquals(PN_DISCONNECTED_CATEGORY, disconnectStatusFromQueue.category.toString())

// Reconnect and wait for reconnect status
pubnub.reconnect()

val reconnectStatusFromQueue = nextStatus()
assertEquals(false, reconnectStatusFromQueue.error)
assertEquals(PN_CONNECTED_CATEGORY, reconnectStatusFromQueue.category.toString())

// Verify our listener captured both statuses
assertNotNull(disconnectStatus)
assertEquals(PN_DISCONNECTED_CATEGORY, disconnectStatus!!.category.toString())
assertNotNull(reconnectStatus)
assertEquals(PN_CONNECTED_CATEGORY, reconnectStatus!!.category.toString())
} finally {
// Cleanup
pubnub.removeListener(statusListener)
}
}
}

@Test
fun can_set_metadata() = runTest {
// when
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,32 @@ class PublishTest : BaseIntegrationTest() {
@Test
fun can_publish_message_string() =
runTest {
val result = pubnub.publish(channel = channel, message = "some message", customMessageType = "myCustomType").await()
val result =
pubnub.publish(channel = channel, message = "some message", customMessageType = "myCustomType").await()
assertTrue { result.timetoken > 0 }
}

@Test
fun can_signal() =
runTest {
val result = pubnub.signal(channel = channel, message = "some message", customMessageType = "myCustomType").await()
val result =
pubnub.signal(channel = channel, message = "some message", customMessageType = "myCustomType").await()
assertTrue { result.timetoken > 0 }
}

@Test
fun can_publish_message_map() =
runTest {
val result = pubnub.publish(channel, mapOf("platform" to PLATFORM, "otherKey" to 123, "another" to true)).await()
val result =
pubnub.publish(channel, mapOf("platform" to PLATFORM, "otherKey" to 123, "another" to true)).await()
assertTrue { result.timetoken > 0 }
}

@Test
fun can_signal_map() =
runTest {
val result = pubnub.signal(channel, mapOf("platform" to PLATFORM, "otherKey" to 123, "another" to true)).await()
val result =
pubnub.signal(channel, mapOf("platform" to PLATFORM, "otherKey" to 123, "another" to true)).await()
assertTrue { result.timetoken > 0 }
}

Expand All @@ -70,6 +74,7 @@ class PublishTest : BaseIntegrationTest() {
fun can_receive_message_with_map_metadata() = runTest {
pubnub.test(backgroundScope) {
pubnub.awaitSubscribe(listOf(channel))

val mapData = mapOf(
"stringValue" to "bbb",
"mapValue" to mapOf("innerKey" to false),
Expand All @@ -89,6 +94,8 @@ class PublishTest : BaseIntegrationTest() {

private fun isIOS() = PLATFORM == "iOS"

private fun isJS() = PLATFORM == "JS"

@Test
fun can_receive_message_with_primitive_payload() = runTest {
pubnub.test(backgroundScope) {
Expand All @@ -113,6 +120,7 @@ class PublishTest : BaseIntegrationTest() {
fun can_receive_message_with_map_payload() = runTest {
pubnub.test(backgroundScope) {
pubnub.awaitSubscribe(listOf(channel))

val mapData = mapOf(
"stringValue" to "bbb",
"mapValue" to mapOf("innerKey" to false),
Expand All @@ -134,6 +142,7 @@ class PublishTest : BaseIntegrationTest() {
fun can_receive_signal_with_map_payload() = runTest {
pubnub.test(backgroundScope) {
pubnub.awaitSubscribe(listOf(channel))

val mapData = mapOf(
"stringValue" to "bbb",
"mapValue" to mapOf("innerKey" to false)
Expand All @@ -151,6 +160,7 @@ class PublishTest : BaseIntegrationTest() {
fun can_receive_message_with_payload_with_floats() = runTest {
pubnub.test(backgroundScope) {
pubnub.awaitSubscribe(listOf(channel))

val mapData = mapOf(
"floatValue" to 1.23f,
"doubleValue" to 1.23,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ actual fun createPNConfiguration(
override val authToken: String?
get() = null
override val enableEventEngine: Boolean
get() = false
get() = true
override val logVerbosity: PNLogVerbosity
get() = logVerbosity
}
Expand Down Expand Up @@ -87,7 +87,7 @@ actual fun createPNConfiguration(
override val authToken: String?
get() = authToken
override val enableEventEngine: Boolean
get() = false
get() = true
override val logVerbosity: PNLogVerbosity
get() = logVerbosity
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ class ParseTokenOther : SnippetBase() {
val pubnub = createPubNub()

// snippet.parseToken
pubnub.parseToken("qEF2AkF0Gmgi5mVDdHRsGQU5Q3Jlc6VEY2hhbqFnc3BhY2UwMQhDZ3JwoENzcGOgQ3VzcqBEdXVpZKFmdXNlcjAxGCBDcGF0pURjaGFuoWdzcGFjZS4qAUNncnCgQ3NwY6BDdXNyoER1dWlkoWZ1c2VyLioYIERtZXRhoER1dWlkbmF1dGhvcml6ZWRVc2VyQ3NpZ1ggkOSK0vQY5LFE5IHctQ6rGokqHbRH8EopbQRGAbU7Zfo=")
pubnub.parseToken(
"qEF2AkF0Gmgi5mVDdHRsGQU5Q3Jlc6VEY2hhbqFnc3BhY2UwMQhDZ3JwoENzcGOgQ3VzcqBEdXVpZKFmdXNlcjAxGCBDcGF0pURjaGFuoWdzcGFjZS4qAUNncnCgQ3NwY6BDdXNyoER1dWlkoWZ1c2VyLioYIERtZXRhoER1dWlkbmF1dGhvcml6ZWRVc2VyQ3NpZ1ggkOSK0vQY5LFE5IHctQ6rGokqHbRH8EopbQRGAbU7Zfo="
)
// snippet.end
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ class SetTokenOther : SnippetBase() {
val pubnub = createPubNub()

// snippet.setToken
pubnub.setToken("qEF2AkF0Gmgi5mVDdHRsGQU5Q3Jlc6VEY2hhbqFnc3BhY2UwMQhDZ3JwoENzcGOgQ3VzcqBEdXVpZKFmdXNlcjAxGCBDcGF0pURjaGFuoWdzcGFjZS4qAUNncnCgQ3NwY6BDdXNyoER1dWlkoWZ1c2VyLioYIERtZXRhoER1dWlkbmF1dGhvcml6ZWRVc2VyQ3NpZ1ggkOSK0vQY5LFE5IHctQ6rGokqHbRH8EopbQRGAbU7Zfo=")
pubnub.setToken(
"qEF2AkF0Gmgi5mVDdHRsGQU5Q3Jlc6VEY2hhbqFnc3BhY2UwMQhDZ3JwoENzcGOgQ3VzcqBEdXVpZKFmdXNlcjAxGCBDcGF0pURjaGFuoWdzcGFjZS4qAUNncnCgQ3NwY6BDdXNyoER1dWlkoWZ1c2VyLioYIERtZXRhoER1dWlkbmF1dGhvcml6ZWRVc2VyQ3NpZ1ggkOSK0vQY5LFE5IHctQ6rGokqHbRH8EopbQRGAbU7Zfo="
)
// snippet.end
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ private fun getAllUUIDMetadataBasic(pubnub: PubNub) {
println("\n# Getting All UUID Metadata (Basic)")

pubnub.getAllUUIDMetadata(
includeCustom = true, // Include custom fields
includeCount = true // Include total count in response
includeCustom = true, // Include custom fields
includeCount = true // Include total count in response
).async { result ->
result.onSuccess { response ->
println("SUCCESS: Retrieved UUID metadata objects")
Expand Down Expand Up @@ -134,10 +134,10 @@ private fun getAllUUIDMetadataWithFilter(pubnub: PubNub) {
val filter = "custom.role == 'Developer'"

pubnub.getAllUUIDMetadata(
filter = filter, // Filter expression
limit = 10, // Maximum number of results
includeCustom = true, // Include custom fields
includeCount = true // Include total count in response
filter = filter, // Filter expression
limit = 10, // Maximum number of results
includeCustom = true, // Include custom fields
includeCount = true // Include total count in response
).async { result ->
result.onSuccess { response ->
println("SUCCESS: Retrieved filtered UUID metadata objects")
Expand Down
Loading
Loading