Stop watching connection state when onNext() is called
See original GitHub issueSo I have discovered a weird bug:
I have subscribed to messages like this inside an injectible service:
this._stompMessages = this._stompService.subscribe('/user/queue/messages');
this.subscription = this._stompMessages.subscribe(this.on_next);
When the on_next method gets called I want to push something to a BehaviorSubject that is a property of this service. So inside on_next I do something like this:
this._messages.next(this._messages.getValue().concat(value));
This causes an UNSUBSCRIBE command, but why?
“Stop watching connection state (for /user/queue/messages)” ng2-stompjs.es5.js:58 “Will unsubscribe from /user/queue/messages at Stomp” ng2-stompjs.es5.js:58 ">>> UNSUBSCRIBE id:sub-0
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Behaviour of onNext and onComplete - Stack Overflow
First I started to just call onComplete, because in the end the observable does its job and completes. But then of course onNext...
Read more >Chapter 1. Reactive Programming with RxJava - O'Reilly
The onNext() method might never be called or might be called once, many, or infinite times. The onError() and onCompleted() are terminal events, ......
Read more >How (not) to use Reactive Streams in Java 9+ | by Jacek Kunicki
Since the implementation is synchronous, there's an issue with unbounded recursion resulting from the subscription's request() calling the ...
Read more >Reactor 3 Reference Guide
In this case, the Disposable interface represents the fact that the subscription can be cancelled, by calling its dispose() method. For a Flux ......
Read more >State Management In Next.js - Smashing Magazine
If you believe there is a relevant pattern to be considered, I look forward to seeing you in the comments section! React Core...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I had a look at your log file. Please try wrapping the code within onNext in a
try-catch
block, similar to the following:Let me know if it solves your issue.
I don’t know if that was the thing that made it work, since i did some smaller tries of things.
But it works now!