https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
reaktive
  • l

    Luigi Scarminio

    08/19/2020, 1:45 PM
    Is there a proper way to filter an Observable stream and log the ones that have been left out?
    a
    • 2
    • 3
  • d

    Dmitry Motyl

    09/02/2020, 11:52 AM
    I see that ktor-client-ios has cancelation handler https://github.com/ktorio/ktor/blob/master/ktor-client/ktor-client-ios/darwin/src/io/ktor/client/engine/ios/IosClientEngine.kt Will it work with coroutine cancelation ? I mean if we wrap it by
    singleFromCoroutine
    and on dispose it will be canceled ?
    a
    • 2
    • 6
  • n

    Nikita Khlebushkin

    11/02/2020, 10:27 AM
    Hello! Is there a native way to convert Reaktive classes into RxSwift?
    a
    o
    • 3
    • 11
  • o

    Omar Mainegra

    12/01/2020, 4:03 PM
    Hi @Arkadii Ivanov, I noticed in v1.1.18 you made the wrappers types parameters non-null (SingleWrapper, ObservableWrapper, etc), this is now preventing me form doing
    SingleWrapper<String?>
    Is there any particular reason to this change? Or workaround to deal with Nullability/Absent of Values?
    a
    • 2
    • 2
  • m

    Mina Eweida

    12/11/2020, 10:54 AM
    Hi @Arkadii Ivanov, with the latest changes in kotlin 1.4 with Ktor, I can see we are able to run it in background on native if we run from
    MainScope
    already tested that on my project, so would it make sense if this is provided in Reaktive through coroutine-interop?
    a
    • 2
    • 11
  • a

    Arkadii Ivanov

    12/18/2020, 10:57 PM
    Reaktive 1.1.19 is released! 📣 • Updated Kotlin to 
    1.4.20
     and coroutines to 
    1.4.2
     (#568) • Added test assertions chaining (#545) • Added 
    invoke
     operator for 
    ValueCallback
     and its 
    Consumer
     typealias (#554) • Various performance improvements (#548, #547, #546) • Use 
    abort()
     instead of 
    exitProcess()
     in Kotlin/Native 
    reaktiveUncaughtErrorHandler
     for better crash stack traces (#567) • Fixed a bug in 
    Observable.buffer
     skip logic (#571) • Sources are now published for 
    rxjava2-interop
     and 
    rxjava3-interop
     modules (#560 by @CherryPerry) • Updated docs (#556)
    🚀 1
    o
    • 2
    • 2
  • a

    Arkadii Ivanov

    12/19/2020, 7:16 PM
    Reaktive is now synchronized with JCenter! Now there should be no need for the additional Bintray repository definition
    maven("<https://dl.bintray.com/badoo/maven>")
    👍 2
    o
    • 2
    • 3
  • s

    saket

    12/30/2020, 2:04 AM
    what would something like Traceur look like for reaktive?
    a
    • 2
    • 3
  • a

    Arkadii Ivanov

    02/02/2021, 9:27 AM
    Hi. Could you please elaborate what is getting frozen?
    a
    • 2
    • 33
  • m

    Mina Eweida

    05/19/2021, 8:09 AM
    Hi @Arkadii Ivanov I see you merged kotlin 1.5.0 PR 4 days ago. Are there plans for releasing a new version soon?
    a
    • 2
    • 7
  • m

    Mike

    06/08/2021, 12:21 AM
    Hi, is there a way to set an unhandled reaktive exception handler similar to Rx? I’m having trouble tracking down a native crash on iOS coming from CreateDefaultUncaughtErrorHandler and the stack trace doesn’t give much clues. abort() is called so it crashes the app. I’d like to set the default handler to log the error but not crash the app.
    a
    • 2
    • 10
  • s

    saket

    06/20/2021, 9:11 PM
    not sure if this is reaktive’s responsibility, but I just learned that this operator always calls
    mapper
    with the same list _instance_:
    Iterable<Observable<T>>.combineLatest(mapper: (List<T>) -> R)
    a
    • 2
    • 3
  • s

    saket

    06/26/2021, 10:46 PM
    can it use a
    CoroutineExceptionHandler
    for launching coroutines?
    a
    • 2
    • 2
  • 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:
    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:
    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?
    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?
    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
    //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:
    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:
    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
    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
Powered by Linen
Title
b

bartosz.malkowski

12/29/2022, 2:07 PM
Hi! I have a problem. I have Observable to observe changes in database:
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
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

Arkadii Ivanov

12/29/2022, 3:15 PM
Is it correct that you want to requery the database when updateSubject emits an item, in addition to the already observed database query?
b

bartosz.malkowski

12/30/2022, 7:21 AM
Yes! This is exactly what I need!
Maybe this is my design fault, but in component to display and manage roster I need to show information about presence, so in my case database query gets data from few tables (including one managed by different component).
a

Arkadii Ivanov

12/30/2022, 9:08 AM
Got it. Something like this should work I guess, from the top of my head:
override fun observeAll(): Observable<List<RosterPresenceItem>> = 
    merge(
        queries
            .query(RosterDatabaseQueries::loadAll)
            .observe {
                it.executeAsList().map { e -> … }
            },
        updateSubject.flatMapSingle {
            queries
                .query(RosterDatabaseQueries::loadAll)
                .single {
                    it.executeAsList().map { e -> … }
                }
        }
)
b

bartosz.malkowski

12/30/2022, 9:45 AM
Thanks. I'll try it. A moment ago I created function
fun <T> Observable<T>.powtorzGdy(observable: Observable<*>): Observable<T> = observable { emitter ->
	var listener: Disposable? = this@powtorzGdy.subscribe(
		onNext = emitter::onNext, onError = emitter::onError, onComplete = emitter::onComplete
	)

	observable.subscribe {
		listener?.dispose()
		listener = this@powtorzGdy.subscribe(
			onNext = emitter::onNext, onError = emitter::onError, onComplete = emitter::onComplete
		)
	}
}
and it works, but I have no idea if it is done correctly 🙂
a

Arkadii Ivanov

12/30/2022, 11:50 AM
Great idea! You can actually use
BehaviorSubject
+
switchMap
:
private val updateSubject = BehaviorSubject(Unit)

    override fun observeAll(): Observable<List<RosterPresenceItem>> = 
        updateSubject.switchMap {
            queries
                .query(RosterDatabaseQueries::loadAll)
                .observe {
                    it.executeAsList().map { e -> … }
                }
        }
Here
switchMap
replaces your
powtorzGdy
function.
b

bartosz.malkowski

12/30/2022, 12:24 PM
Thanks!
View count: 8