Questions tagged [publishsubject]
25 questions
5
votes
1 answer
RxSwift Subject not firing event when called
I have an app using MVP with the Coordinator pattern.
When a child coordinator sends and event, I would expect my AppCoordinator to recursively call a method that selects the next coordinator based on some SessionState.
The basic flow of the app is…

Tim J
- 1,211
- 1
- 14
- 31
2
votes
1 answer
RXJava2 manage subscriptions
I need to clarify about what is the best approach for managing the specific scenario using RxJava2 (the whole app structure is based on it):
In my app, a lot of people can make changes in the same document, so I need to deliver every change to…

Fernando Augusto
- 43
- 3
2
votes
1 answer
Observable withLatestFrom value
I Implemented a pseudo-operator called "FilterByLatestFrom" as an extension function for kotlin.
I wrote the next code using this operator:
fun testFilterByLatestFromOperator(){
val observableA : Observable =…

Yaniv Bouhadana
- 53
- 2
- 7
1
vote
0 answers
RxJava 3 - PublishSubject emit data after subscribe
I want to listen on relay and after subscribe emit first item on the same relay. So naturally I wrote:
val relay = PublishSubject.create()
relay
.doOnSubscribe { relay.onNext(1) }
.subscribe {
println("Test: $it")
}
And…

Lau
- 1,804
- 1
- 23
- 49
1
vote
1 answer
Why isn't my rx subscription triggered on my onNext?
Playing around with Rx Swift I have run into a situation where my subscription doesn't trigger.
I have two viewControllers. The first has a label that the subscriber should update, like this:
func listen() {
print("In func")
let sec =…

Joakim Sjöstedt
- 824
- 2
- 9
- 18
1
vote
1 answer
PublishSubject does not emit items
Why the code below does not emit any result? What is going wrong in this Subject? I would expect that on the moment I subscribe would get a result, namely the length I declare.
val subject = PublishSubject.create()//PublishRelay.accept()…

Drocchio
- 383
- 4
- 21
1
vote
0 answers
PublishSubject in RxJava/RxAndroid causes crash onError and skips onNext
I have a code like this:
Process X:
getLocationObservable() // ---> async operation that fetches the location.
// Once location is found(or failed to find) it sends it to this filter :
.filter(location -> {
---…

BVtp
- 2,308
- 2
- 29
- 68
1
vote
1 answer
onNext not called for PublishSubject in android, rxjava?
I am using rxjava 2 and trying to use rxbus for passing a value
rxbus code
public class SeasonTabSelectorBus {
private static SeasonTabSelectorBus instance;
private PublishSubject

WISHY
- 11,067
- 25
- 105
- 197
1
vote
1 answer
RxSwift trigger observable execution
I have a Subject observable representing the result of the network request that needs to be delivered to multiple subscribers.
I can use ReplaySubject of buffer 1 and publish() method. However, the network request gets executed only once.
I'd like…

Richard Topchii
- 7,075
- 8
- 48
- 115
1
vote
1 answer
onNext() never gets called on a PublishSubject
I am trying to build a presenter that calculates some events within some time period, shows a loading only the first time of loading, and updates the ui when it is done. Because the events can be updated via multiple ways (such as user preferences)…

Alex Styl
- 3,982
- 2
- 28
- 47
1
vote
1 answer
Why onSubscribe does not work in rxjava?
when I run below code if I don't write observeOn line, app crashes because getView().showBlockLayout(isBlock); invoke a method that try to hide or show a layout.
but I tried to change below observeOn(AndroidSchedulers.mainThread()) to…

Siavash Abdoli
- 1,852
- 3
- 22
- 38
1
vote
1 answer
RxSwift: binding PublishSubject to multiple buttons and receive sender
I am working on an app that presents 26 (alphabet) buttons. Right now they're all connected to the same function in the ViewController, that in turn calls another function in the ViewModel, and finally this function calls publishSubject.onNext().…

Yotam
- 9,789
- 13
- 47
- 68
0
votes
1 answer
RxJava as event bus is called multiple times even when only once triggered
I am trying to implement the RxJava event bus, where my use case is to get triggered when subscribed and when the event is sent. But with my code even when I send the event once, I am receiving multiple events. It is working fine for the first time,…

Revanth Kovuri
- 161
- 1
- 11
0
votes
1 answer
Process one PublishSubject emission at a time with a chain of operators in RxJava2
I have a PublishSubject.
On each new Event I trigger a database query (some locally cached data), then take the result and try to POST it via HTTP request to a server, when this server replies 200 I make another database query to delete the…

pratclot
- 326
- 2
- 8
0
votes
1 answer
PublishSubject onError function in Kotlin
So, I am getting an error in my Android app (Kotlin) when trying to subscribe to a PublishSubject.
The error explanation is pretty straight forward, however, I have failed trying to implement this, onError function and I am not sure how to do it in…

codeKiller
- 5,493
- 17
- 60
- 115