centrifugal / centrifuge-android Goto Github PK
View Code? Open in Web Editor NEWAndroid client to communicate with Centrifugo v1 over Websockets (not maintained anymore)
Android client to communicate with Centrifugo v1 over Websockets (not maintained anymore)
Centrifugo sends Disconnect Advice in connection close reason (in Close Websocket frame). It's a JSON encoded string which contains 2 fields at moment, for example
{
"reason": "shutting down",
"reconnect": true
}
Client should follow this reconnect
advice - if it's false
then client should not attempt to reconnect.
Is it possible to send messages with this library?
gomobile allows to easily compile for IOS and Android.
The low hanging fruit is to write the proxy client code in golang and cross compile it to IOS and android.
Its not hard these days.
This is a suggestion, because i have done this on other projects, but i dont use centrifugal, and dont have time to do it.
We use centrifuge lib to communicate with Sockets. Everything works well but this code :
val credentials = Centrifuge.newCredentials(
getCurrentUserId(),
webSocketToken.timestamp,
EMPTY_STRING,
webSocketToken.token
)
throws this error, it only happens with android based on arm structure. Here is the output:
Fatal Exception: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.namba-_dbpnhlp0R3PyG4erhR_2w==/base.apk"],nativeLibraryDirectories=[/data/app/com.namba-_dbpnhlp0R3PyG4erhR_2w==/lib/arm64, /system/lib64, /vendor/lib64]]] couldn't find "libgojni.so"
at java.lang.Runtime.loadLibrary0 + 1012(Runtime.java:1012)
at java.lang.System.loadLibrary + 1669(System.java:1669)
at go.LoadJNI. + 23(LoadJNI.java:23)
at java.lang.Class.classForName(Class.java)
at java.lang.Class.forName + 453(Class.java:453)
at java.lang.Class.forName + 378(Class.java:378)
at go.Seq. + 28(Seq.java:28)
at go.Seq.touch()
at centrifuge.Centrifuge. + 11(Centrifuge.java:11)
at centrifuge.Centrifuge.newCredentials(Centrifuge.java)
at com.namba.websocket.CentrifugoWebSocketClient.createClient + 214(CentrifugoWebSocketClient.kt:214)
at com.namba.websocket.CentrifugoWebSocketClient$initClient$1.invokeSuspend + 145(CentrifugoWebSocketClient.kt:145)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith + 32(ContinuationImpl.kt:32)
at kotlinx.coroutines.DispatchedTask$DefaultImpls.run + 235(Dispatched.kt:235)
at kotlinx.coroutines.DispatchedContinuation.run + 81(Dispatched.kt:81)
at kotlinx.coroutines.scheduling.Task.run + 94(Tasks.kt:94)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely + 586(CoroutineScheduler.kt:586)
at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely + 60(CoroutineScheduler.kt:60)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run + 732(CoroutineScheduler.kt:732)
Hi,
When I send message from server, Android SDK throw error, because there is no timestamp
property. seems the centrifugo server remove this property?
Could you update SDK to fix this?
Thanks...
This repo needs maintainer, we need a help with current issues and migration to adapt Centrifugo v2 changes very soon.
Client in pure java, to connect via wss or ws
I have exception
FATAL EXCEPTION: Centrifugo Process: pro.myburse.app, PID: 27180 java.lang.NullPointerException: ssl == null at com.android.org.conscrypt.NativeCrypto.SSL_set_timeout(Native Method) at com.android.org.conscrypt.SslWrapper.setTimeout(SslWrapper.java:101) at com.android.org.conscrypt.ActiveSession.invalidate(ActiveSession.java:147) at com.android.org.conscrypt.DelegatingExtendedSSLSession.invalidate(DelegatingExtendedSSLSession.java:120) at org.java_websocket.SSLSocketChannel2.close(SSLSocketChannel2.java:268) at org.java_websocket.WebSocketImpl.closeConnection(WebSocketImpl.java:453) at org.java_websocket.WebSocketImpl.eot(WebSocketImpl.java:511) at org.java_websocket.client.WebSocketClient.interruptableRun(WebSocketClient.java:249) at org.java_websocket.client.WebSocketClient.run(WebSocketClient.java:188) at java.lang.Thread.run(Thread.java:764)
on centrifugo.disconnect()
Probke is not only in exception - I can't catch it
i want to send message to centrifuge service , but library project Centrifugo.java no have sendMsg method ?
add sendMessage method in Centrifugo.java ?
When connect to secure server (wss) i get the error:
I/CentrifugoClient: onClose: -1, draft org.java_websocket.drafts.Draft_17@bc1f8b0 refuses handshake, false
.
SSL certificate issue?
After I call centrifugo.connect();
,it does not work.And It never call ConnectionListener
whether the server can not achieve.
Fatal Exception: or
at org.java_websocket.WebSocketImpl.send(SourceFile:566)
at org.java_websocket.WebSocketImpl.send(SourceFile:543)
at org.java_websocket.client.WebSocketClient.send(SourceFile:171)
at com.centrifugal.centrifuge.android.Centrifugo$Client.access$201(SourceFile:496)
at com.centrifugal.centrifuge.android.Centrifugo$Client$3.run(SourceFile:587)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
@SammyVimes could you look at this?
How do you know the current connection state, for example, the current connection is broken.How can I judge? Thank you very much!
I have gotten this exception several times
bcore.io.IoBridge.connectErrno (IoBridge.java:189) libcore.io.IoBridge.connect (IoBridge.java:127) libcore.io.IoBridge.connect (IoBridge.java:115) java.nio.SocketChannelImpl.connect (SocketChannelImpl.java:199) org.java_websocket.client.WebSocketClient.interruptableRun (WebSocketClient.java:210) org.java_websocket.client.WebSocketClient.run (WebSocketClient.java:188) java.lang.Thread.run (Thread.java:818)
We just released Centrifugo v1.6.0 - it has no client protocol backwards incompatible changes, but has some protocol optimizations.
To be more concrete: Centrifugo can return single object response now where it returned array of objects in response to command before. For example in connect response. Client should already handle this as it's a protocol requirement to work both with array and single object responses.
@SammyVimes could you test it with Centrifugo v1.6.0? Hopefully it will just work. I can not do this myself unfortunately as I am too far from Android world.
As far as I can see there are 2 methods one and two in subscription object so it's possible to set private sign. But to create sign users also need to know client ID of current connection.
@SammyVimes could you document how to do private channel subscription?
After reconnecting and and re-subscribing to the channel receives permission denied
error. And then works only on a new session (centrifuge re-initializing). Unfortunately, there are no clear steps to reproduce, happens randomly.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.