vinted / actioncable-client-kotlin Goto Github PK
View Code? Open in Web Editor NEWRuby WebSockets implementation (Action Cable) client library for Kotlin.
License: MIT License
Ruby WebSockets implementation (Action Cable) client library for Kotlin.
License: MIT License
My ruby server's ActionCable requires this header. Will the library support them in the future?
I see that it's possible to provide a preconfigured OkHttpClient
via Connection.Options.okHttpClientFactory
. However, I need to provide a dedicated OkHttp WebSocket.Factory
. (Note an important detail: although OkHttpClient
is open
and implements WebSocket.Factory
, calling newBuilder()
means that it is not actually possible to override behaviour, see discussion here square/okhttp#6242).
This is an easy change I think, so I can make a PR. Just checking to see if someone is available to review it, since it's fairly quiet around here. Thanks!
E.g. it is possible to add a channel with the same id more than single time:
val channel = Channel(channel = "foo", params = mapOf())
val subscription = consumer.subscriptions.create(channel)
val subscription2 = consumer.subscriptions.create(channel)
Investigation needed of having a check inside Subscriptions.create()
.
Config could be ported from: https://github.com/vinted/preferx/blob/master/prefeRx/build.gradle#L52-L67
Currently we can set options like that:
val uri = URI("ws://cable.example.com")
val options = Consumer.Options()
options.connection.reconnection = true
val consumer = ActionCable.createConsumer(uri, options)
We could change it to something like:
val uri = URI("ws://cable.example.com")
val options = Consumer.Options()
.withReconnection(true)
.build()
val consumer = ActionCable.createConsumer(uri, options)
Benefits:
At the moment there is a possibility to remove single subscription:
consumer.subscriptions.remove(subscription)
Would be nice to have something like this:
consumer.clearAllSubscriptions()
Hello I'm getting this error, and can't use any of the classes, the same happens to me with the original project actioncable-client-java
I'm using
Android Gradle Plugin Version 7.0.4
Gradle Version 7.0.2
build.gradle(project)
buildscript {
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.0"
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Currently supported way to subscribe to the channel:
val subscription = consumer.subscriptions.create(channel)
consumer.connect()
But subscription callbacks won't work in this scenario:
consumer.connect()
val subscription = consumer.subscriptions.create(channel)
Therefore, it is impossible to subscribe to the channel after initial web socket connection instantiation.
In my subscription.onReceived I am getting a LinkedTreeMap instead of JsonObject.
Hi, can this library be migrated to mavencentral?
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.