Currently im learning how to use RxJava. I fully understand the concept of the reactive Programming paradigma where the programm needs to react to certain types of changes (Userinputs, Sensordata, etc.)
A lot of Tutorials and even the RxJava Github page explains RxJava in a very Simple way of creating a Observable and Observer. Subscribe the Observer to the Observable and you get the Stream of Data you just created manually by yourself. So like i see this, everytime i restart the Programm / App my Observer Subscribe --> gets the Data --> and then receive the onComplete. Does that mean, that the Observer is still subscribed to the Observer at this point? Or does a OnComplete Message unsubscribe the Observer?
I just cant get my Head arround this. I think of a Program (App or Backend Service) that get random Sensor Data from a Local Arduino. The Sensor Data comes in at random Time in total random variety. Can i do a one time subscription and as long the Programm runs (on my Server or on my Smartphone) the Observer is subscribed to the specific "sensor Data" Observable and even on Complete (After receiving the arriving data) its still listening for the next data that eventually comes from the sensor?
Is that right? Or do i have some kind of missunderstanding?
Once you get
onComplete, stream is considered as terminated. Check: http://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/org/reactivestreams/Subscriber.html#onComplete()