File tree Expand file tree Collapse file tree 15 files changed +21
-13
lines changed
pubnub-kotlin/pubnub-kotlin-docs/src/main/kotlin/com/pubnub/docs
publishAndSubscribe/publish Expand file tree Collapse file tree 15 files changed +21
-13
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ fun main() {
22
22
val userId = UserId (" uuid-metadata-demo-user" )
23
23
val config = PNConfiguration .builder(userId, " demo" ).apply {
24
24
publishKey = " demo"
25
- logVerbosity = PNLogVerbosity .BODY // Enable debug logging
25
+ logVerbosity = PNLogVerbosity .BODY // Enable debug logging of network calls
26
26
}.build()
27
27
28
28
// 2. Create PubNub instance
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ fun createAdvancedConfig(): PNConfiguration {
69
69
suppressLeaveEvents = false // Whether to send leave events when disconnecting
70
70
71
71
// Debugging parameters
72
- logVerbosity = PNLogVerbosity .BODY // Enable debug logging
72
+ logVerbosity = PNLogVerbosity .BODY // Enable debug logging of network calls
73
73
74
74
// Retry configuration (for reconnection)
75
75
retryConfiguration = RetryConfiguration .Linear (
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import com.pubnub.api.PubNub
4
4
import com.pubnub.api.UserId
5
5
import com.pubnub.api.crypto.CryptoModule
6
6
import com.pubnub.api.v2.PNConfiguration
7
+ import com.pubnub.api.v2.PNConfigurationOverride
7
8
import com.pubnub.docs.SnippetBase
8
9
import java.net.InetSocketAddress
9
10
import java.net.Proxy
@@ -116,8 +117,14 @@ class ConfigurationOther : SnippetBase() {
116
117
private fun configurationSetUserId () {
117
118
// todo add link once created
118
119
// snippet.configurationSetUserId
120
+ // Setting the userId during initialization
119
121
val builder = PNConfiguration .builder(UserId (" abc" ), " subscribeKey" )
120
122
val pubnub = PubNub .create(builder.build())
123
+
124
+ // Setting the userId after initialization
125
+ val pnConfigurationWithModifiedUserId: PNConfiguration = PNConfigurationOverride .from(pubnub.configuration).apply {
126
+ userId = UserId (" new-user-id" )
127
+ }.build()
121
128
// snippet.end
122
129
}
123
130
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ fun main() {
17
17
val config = PNConfiguration .builder(userId, " demo" ).apply {
18
18
publishKey = " demo"
19
19
subscribeKey = " demo"
20
- logVerbosity = PNLogVerbosity .BODY // Enable debug logging
20
+ logVerbosity = PNLogVerbosity .BODY // Enable debug logging of network calls
21
21
}.build()
22
22
23
23
// 2. Create PubNub instance
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ fun main() {
16
16
val config = PNConfiguration .builder(userId, " demo" ).apply {
17
17
publishKey = " demo"
18
18
subscribeKey = " demo"
19
- logVerbosity = PNLogVerbosity .BODY // Enable debug logging
19
+ logVerbosity = PNLogVerbosity .BODY // Enable debug logging of network calls
20
20
}.build()
21
21
22
22
// 2. Create PubNub instance
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ fun main() {
17
17
val config = PNConfiguration .builder(userId, " demo" ).apply {
18
18
publishKey = " demo"
19
19
subscribeKey = " demo"
20
- logVerbosity = PNLogVerbosity .BODY // Enable debug logging
20
+ logVerbosity = PNLogVerbosity .BODY // Enable debug logging of network calls
21
21
}.build()
22
22
23
23
// 2. Create PubNub instance
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ fun main() {
16
16
val config = PNConfiguration .builder(userId, " demo" ).apply {
17
17
publishKey = " demo"
18
18
subscribeKey = " demo"
19
- logVerbosity = PNLogVerbosity .BODY // Enable debug logging
19
+ logVerbosity = PNLogVerbosity .BODY // Enable debug logging of network calls
20
20
}.build()
21
21
22
22
// 2. Create PubNub instance
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ fun main() {
24
24
val userId = UserId (" file-upload-demo-user" )
25
25
val config = PNConfiguration .builder(userId, " demo" ).apply {
26
26
publishKey = " demo"
27
- logVerbosity = PNLogVerbosity .BODY // Enable debug logging for visibility
27
+ logVerbosity = PNLogVerbosity .BODY // Enable debug logging of network calls
28
28
}.build()
29
29
30
30
// 2. Create PubNub instance
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ fun main() {
16
16
val userId = UserId (" message-action-demo-user" )
17
17
val config = PNConfiguration .builder(userId, " demo" ).apply {
18
18
publishKey = " demo"
19
- logVerbosity = PNLogVerbosity .BODY // Enable debug logging for visibility
19
+ logVerbosity = PNLogVerbosity .BODY // Enable debug logging of network calls
20
20
}.build()
21
21
22
22
// 2. Create PubNub instance
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ fun main() {
26
26
val userId = UserId (" push-helper-demo-user" )
27
27
val config = PNConfiguration .builder(userId, " demo" ).apply {
28
28
publishKey = " demo"
29
- logVerbosity = PNLogVerbosity .BODY // Enable debug logging
29
+ logVerbosity = PNLogVerbosity .BODY // Enable debug logging of network calls
30
30
}.build()
31
31
32
32
// 2. Create PubNub instance
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ fun main() {
30
30
val userId = UserId (" push-notifications-demo-user" )
31
31
val config = PNConfiguration .builder(userId, " demo" ).apply {
32
32
publishKey = " demo"
33
- logVerbosity = PNLogVerbosity .BODY // Enable debug logging
33
+ logVerbosity = PNLogVerbosity .BODY // Enable debug logging of network calls
34
34
}.build()
35
35
36
36
// 2. Create PubNub instance
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ fun main() {
15
15
val userId = UserId (" here-now-demo-user" )
16
16
val config = PNConfiguration .builder(userId, " demo" ).apply {
17
17
publishKey = " demo"
18
- logVerbosity = PNLogVerbosity .BODY // Enable debug logging
18
+ logVerbosity = PNLogVerbosity .BODY // Enable debug logging of network calls
19
19
}.build()
20
20
21
21
// Create PubNub instance
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ class HereNowOther {
29
29
e.pubnubError
30
30
}
31
31
}
32
+ // snippet.end
32
33
}
33
34
34
35
private fun hereNowReturnOccupancyOnly (pubnub : PubNub ) {
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ fun main() {
14
14
val userId = UserId (" publish-demo-user" )
15
15
val config = PNConfiguration .builder(userId, " demo" ).apply {
16
16
publishKey = " demo"
17
- logVerbosity = PNLogVerbosity .BODY // Enable debug logging
17
+ logVerbosity = PNLogVerbosity .BODY // Enable debug logging of network calls
18
18
}.build()
19
19
20
20
// Create PubNub instance
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ class PublishOthers {
52
52
println (" Message sent, timetoken: ${publishResult.timetoken} " )
53
53
}
54
54
}
55
- // snipped .end
55
+ // snippet .end
56
56
}
57
57
58
58
private fun publishJsonArrayGSON () {
You can’t perform that action at this time.
0 commit comments