centrifugal / centrifugal/centrifuge-java

disconnected stale, reconnect false error on android

Open
#20 27 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
76
Forks
38
Avg merge
4h 18m
Merged PRs (30d)
10

Description

hi dear

i use your java library on android with kotlin implemention
but when i try to connect with JWT token, returns disconnected stale, reconnect false error
but on iOS(swift) and Web version every thing is ok

this is my code

`
val cfListener = object : EventListener() {
override fun onConnect(client: Client?, event: ConnectEvent?) {
Log.d("CENTRIFUGE", "connected")
}

override fun onDisconnect(client: Client?, event: DisconnectEvent) {
Log.d(
"CENTRIFUGE",
"disconnected %s, reconnect %s%n".format(event.reason, event.reconnect)
)
}

override fun onError(client: Client?, event: ErrorEvent?) {
super.onError(client, event)
Log.d("CENTRIFUGE", event.toString())
}
}

Log.d("CENTRIFUGE", Globals.CENTRIFUGE_TOKEN)

val cfClient = Client(
Constants.centrifugeBrokerUrl,
Options(),
cfListener
)

cfClient.setToken(Globals.CENTRIFUGE_TOKEN)
cfClient.connect()

val cfSubListener = object : SubscriptionEventListener() {
override fun onSubscribeSuccess(sub: Subscription, event: SubscribeSuccessEvent?) {
Log.d("CENTRIFUGE", "subscribed to " + sub.channel)
}

override fun onSubscribeError(sub: Subscription, event: SubscribeErrorEvent) {
Log.d(
"CENTRIFUGE",
"subscribe error " + sub.channel.toString() + " " + event.message
)
}

override fun onPublish(sub: Subscription, event: PublishEvent) {
val data = String(event.data, UTF_8)
Log.d("CENTRIFUGE", "message from " + sub.channel.toString() + " " + data)
}
}

try {
val subscription = cfClient.newSubscription("chat#${Globals.SHOP_ID}", cfSubListener)
subscription.subscribe()
}catch (e: DuplicateSubscriptionException){
Log.d("CENTRIFUGE", e.message)
}`

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Kotlin connection and subscription snippet in the issue, then review the 27-comment thread for any Android, JWT, or reconnect findings. Reproduce the stale disconnect on Android and compare it with the working iOS and Web cases; done requires a confirmed cause and a verified correction or clear usage guidance.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, kotlin
Domain
mobile, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.