Coder Social home page Coder Social logo

actioncable-client-kotlin's People

Contributors

bobes avatar chrisfillmore avatar gediminaszukas avatar neworld avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

actioncable-client-kotlin's Issues

Failed to resolve: com.vinted:actioncable-client-kotlin:0.5.4

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
}

Add webSocketFactory to Connection.Options

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!

Use builder for building options

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:

  • Imutable options object
  • More stable library ABI
  • Cleaner options setup API

Forbid to create channel with the same id

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().

Impossible to subscribe to the new channel after consumer.connect()

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.