https://kotlinlang.org logo
Join SlackCommunities
Powered by
# reaktive
  • s

    saket

    07/04/2021, 5:20 AM
    Is it possible to recreate ReplayingShare with reaktive’s operators? https://github.com/JakeWharton/RxReplayingShare
    a
    • 2
    • 5
  • l

    lehakorshun

    07/10/2021, 7:56 AM
    Hi, I try ti use
    Single<T>.doOnAfterSuccess
    , as doc says
    Calls the action with the emitted value when the Single signals onSuccess. The action is called after the observer is called.
    but my action is called first, before onSuccess in subscriber. what can be wrong?
    a
    • 2
    • 12
  • s

    saket

    08/13/2021, 4:36 AM
    Am I reading this correctly that reaktive does not freeze items emitted by a
    Source
    ?
    subscribeOn
     freezes both its upstream source and downstream observer, all the Disposables (upstream’s and downstream’s) are frozen as well, all the values (including errors) are not frozen by the operator
    I’m consuming an
    Observable
    from k/native, and I wanted to confirm that doing this is expected:
    Copy code
    upstream.map {  it.freeze() }
    a
    • 2
    • 4
  • s

    saket

    08/13/2021, 2:50 PM
    I found a super simple way for using Reaktive streams with SwiftUI. Sharing it here in case it’s useful to others: https://gist.github.com/saket/62b1ccfc1a92c393be60a1cfd5357d98 Here’s what my usage code looks like:
    Copy code
    struct FooView: View {
      let presenter: FooPresenter
    
      var body: some View {
        Present(presenter) { model ->
          Text(model.name)
        }
      }
    }
    a
    l
    • 3
    • 8
  • s

    saket

    09/04/2021, 6:43 PM
    Has anyone tried exposing a function to Swift for creating an observable without losing generics?
    a
    • 2
    • 9
  • a

    Andrew Steinmetz

    09/22/2021, 4:49 PM
    Hello, just started using Reaktive and have a general question of when to use
    subscribeOn
    and
    observeOn
    . When I was looking at the Todo sample I saw the repository had the following which if I understand correctly will make sure the values being observed are consumed on the background thread? Is there a reason to not also chain a
    subscribeOn(ioScheduler)
    to enforce all values computed are on a background thread? Or is that just SqlDelight only doing queries on a background thread that prevents the need for that?
    Copy code
    private fun <T : Any> query(query: (TodoDatabaseQueries) -> Query<T>): Single<Query<T>> =
            queries
                .observeOn(ioScheduler)
                .map(query)
    I noticed that in one of the stores that
    observeOn(mainScheduler)
    is only called to make sure updates to UI are done on the UI, but there is no
    subscribeOn(ioScheduler)
    so was curious how the computations were being done on a background thread?
    Copy code
    database
                    .updates
                    .observeOn(mainScheduler)
                    .map(Result::ItemsLoaded)
                    .subscribeScoped(onNext = ::dispatch)
    Thanks!
    a
    • 2
    • 2
  • n

    Nikola Milovic

    09/28/2021, 11:43 AM
    I have a ChatClient in my common code ( expect class currently implemented in JS) and am trying to have some kind of method to subscribe to new messages that come from the WebSocket. And to clear the subscription when the subscriber gets cleaned up. (Using stores from MVIKotlin). I am really lost at the moment, I cannot navigate the library to find what I need, this is what I am trying to achieve
    Copy code
    //inside jsMain actual ChatClient
        private val observable : Observable<MessageModel> = 
    
        actual fun subscribeToNewMessages(observer or something to subscribe to the stream of messages){
            observable.subscribe With The Observer
        }
        actual fun somehow Clear the Subscription when Neccessary()
    
        socket.on("received_message") { mess ->
           observable.somehow Send to observers (mess)
        }
    Hopefully this makes sense
    a
    • 2
    • 1
  • e

    Eugen Martynov

    10/16/2021, 1:00 PM
    Hi people, do you know any open source project with Ktor and Reaktive? It looks like Ktor is using MT coroutines now, I want to try the integration with Reaktive.
    a
    • 2
    • 2
  • a

    Arkadii Ivanov

    10/17/2021, 12:31 AM
    Reaktive
    1.2.1
    is released! •
    combineLatest
     now emits 
    List
     copies instead of same instances (#627) • Used 
    CoroutineExceptionHandler
     in 
    coroutines-interop
     module for better exception handling (#628) • Added KDocs for all operators and 
    Subjects
     (#632, #633, #640, #642, #643) • Updated Kotlin to 1.5.30 (#637) • Added Apple silicon targets (#639) • Added various 
    buffer
     operators (#645)
    👍 1
    🎉 4
    e
    • 2
    • 3
  • k

    Kyle Roe

    12/20/2021, 2:34 PM
    Hey everyone, I was wondering if there is a source of documentation other than the docs in the source code?
    a
    • 2
    • 6
  • d

    Dmitry Motyl

    02/03/2022, 9:45 AM
    Hi! Do you have plans to update to kotlin 1.6.0?
    a
    • 2
    • 3
  • t

    trashcoder

    03/16/2022, 10:50 PM
    hi, i am new to reaktive and Rx in general. i try to listen to server-sent events (with ktor cio) and i would like to know if any of the existing ways to create observables might fit my needs. i thought i could use the reaktive coroutine functions but since there was only
    maybe
    ,
    single
    and
    completable
    , i ended up creating my own observable. it seems to work but i would like to know, if this is the way that is meant to be used. especially in combination with coroutines. (see thread for code)
    a
    • 2
    • 8
  • l

    Luigi Scarminio

    07/20/2022, 12:23 PM
    Hello everyone! I don't have solid concepts on ReactiveX yet. What I'm trying to do is to download new files from an FTP server. The sequence that I'm currently thinking of is connect -> list files from FTP -> filter out files that are already in local path -> download new files. How to do this on a ReactiveX way, without having to pass the FTP connection as a parameter and returning it as an output for the next operator? I don't think having something like this is the correct way:
    Copy code
    fun listFilesFromFTP(ftpConnection : Connection) : Pair<Connection, List<Files>>
    
    connectionObservable.flapMap(::listFilesFromFTP).flapMap(::filterLocalFiles)  ... and so on...
    a
    • 2
    • 3
  • d

    Dmitry Motyl

    07/28/2022, 12:11 PM
    Hi everyone! I have subscription with
    debounce
    It works well on iOS, but on Android it doesn’t fire if app is in background near 15 min. There is some specific I should know ?
    a
    • 2
    • 4
  • l

    Luigi Scarminio

    08/03/2022, 2:44 PM
    Hi everyone! Is there anyone working with Reaktive and JavaFX? I need a JavaFX Scheduler. Thanks!
    a
    • 2
    • 3
  • d

    Dmitry Motyl

    10/06/2022, 10:46 AM
    Hi everyone! There is
    rxjava-interop
    What is about
    Combine
    or
    RxSwift
    ? Did somebody try to implement it ?
    a
    • 2
    • 2
  • b

    bartosz.malkowski

    12/29/2022, 2:07 PM
    Hi! I have a problem. I have Observable to observe changes in database:
    Copy code
    override fun observeAll(): Observable<List<RosterPresenceItem>> = queries.query(RosterDatabaseQueries::loadAll)
    		.observe {
    			it.executeAsList().map { e -> … }
    		}
    Sometimes I need to push new content from database to all subscribers, when something will be published in
    Copy code
    val updateSubject = PublishSubject<Unit>()
    I thought that
    repeatWhen()
    should be used for that, but I don't know how to use it. Any hints?
    a
    • 2
    • 7
  • d

    Dmitry Motyl

    12/29/2022, 2:13 PM
    updateSubject.startWith(Unit).switchMap { database.fetch() }.sharedReplay(1)
  • m

    Marc

    02/10/2023, 12:27 PM
    Hey, this may be a bias channel to ask this but do you have an opinion for usecases of reaktive vs normal coroutine flows? Thanks!
    a
    d
    • 3
    • 8
  • s

    StavFX

    05/11/2023, 6:17 PM
    Hey, for a new project we are thinking to completely avoid coroutines and stick with rx with Reaktive. Now I'm just starting to play with KMM for the first time and I'm trying to make a simple network request. All the examples I'm seeing (Ktor, Fuel) are using suspend functions. Should I just use
    coroutines-interop
    or is there a way to get synchronous calls out of the popular libraries for kmm networking?
    a
    • 2
    • 3
  • s

    StavFX

    05/11/2023, 6:49 PM
    I'm playing around with Jetpack Compose as well and I saw this https://developer.android.com/reference/kotlin/androidx/compose/runtime/rxjava2/package-summary So I'm assuming the path of least resistance for me would be something like
    Copy code
    @Composeable 
    fun Foo() {
      val state by someReaktiveSingle.asRxJava2SingleSource().subscribeAsState()
      ...
    }
    Does that make sense? Where should the conversion from Reaktive to rx2 happen? It shouldn't really happen in the
    commonMain
    layer, right? iOS won't know what to do with it
    a
    • 2
    • 8
  • s

    StavFX

    05/12/2023, 8:29 PM
    Reaktive sounds like a huge undertaking (re-impl rx from scratch). Did you do any performance comparisons with the "tried and tested" solutions like rxjava2?
    a
    • 2
    • 6
  • d

    Dmitry Motyl

    06/08/2023, 8:37 AM
    Hi all I tried to add
    Copy code
    implementation("com.badoo.reaktive:rxjava3-interop:1.3.0")
    into
    compose-multiplatform-ios-android-template
    and I am getting errors.. Could somebody help to figure out with it ?
    Untitled
    a
    • 2
    • 13
  • a

    Arkadii Ivanov

    06/08/2023, 4:39 PM
    Reaktive 2.0.0-alpha01 is released! Lots of improvements! 👉 API improvements (conversion to kotlin.time.Duration, etc.) 👉 Dropped support of the legacy K/N memory model 👉 Significant performance improvements on all platforms 👉 Dropped support of deprecated platforms 👉 And many more! Release notes: https://github.com/badoo/Reaktive/releases/tag/2.0.0-alpha01
    K 2
    🎉 1
  • m

    Mike

    07/13/2023, 5:54 AM
    (Swift interop) Hi, I know that we can use SingleWrapper and ObservableWrapper (per https://github.com/badoo/Reaktive/blob/master/docs/SwiftInterop.md) to use KN reaktive observables in Swift code, but is there any way to create a reaktive observable from Swift code so it can be used in KN code? In particular I have some platform specific functions on iOS/Android that should return a reaktive observable, and I'm trying to use it in some KN common code.
    a
    • 2
    • 2
  • m

    Mike

    08/02/2023, 9:09 AM
    Has anyone seen issues with Reaktive after upgrading from Kotlin 1.7 to 1.8/1.9 where sometimes an iOS app freezes after restarting from the background in low mem scenarios? After commenting out a bunch of network calls that uses reaktive, the issue went away, and now I'm trying to narrow it down to the problematic call. This only repros on 1.8/1.9 and not 100% repro. It wasn't a problem on 1.7. I think there is some kind of deadlock occurring. The app becomes unresponsive until I background it, and then the OS kills it after 10 seconds (and a crash .ipa file is generated with no stacktrace, though it does mention a bunch of rx calls pending)
    a
    • 2
    • 19
  • a

    Arkadii Ivanov

    06/07/2024, 1:08 PM
    Great news! Reaktive has been added to the ReactiveX website! https://reactivex.io/languages.html
    🚀 1
  • a

    Arkadii Ivanov

    06/07/2024, 1:09 PM
    Also, Reaktive
    2.2.0
    is released with the update to Kotlin
    2.0.0
    ! Release notes: https://github.com/badoo/Reaktive/releases/tag/2.2.0
    🎉 2
  • a

    Andrew Rosenblatt

    07/27/2024, 2:44 PM
    Hey looking for an example or docs on using a PublishSubject in the shared kotlin module and subscribing to that stream in native Swift. I'm correct in assuming this can be done?
    a
    • 2
    • 1
  • m

    martmists

    11/19/2024, 3:06 PM
    Does reaktive have some sort of ObservableList? I can find Observable which returns items as it receives them, but the
    toList
    states it only works on finite observables. What do I do to get a snapshot state of an infinite observable? (and/or is there a way to clear elements from an observable?) Or is there a different class I should be looking at?
    a
    • 2
    • 6