<https://twitter.com/RakeebJH11/status/96040854431...
# rx
e
In your
numberGenerator
example, try unscribe
firstFeed
before subscribing with
secondFeed
, you will see two invocation of
Shutting down.....
a
@rakeeb how do you make these graphics [the image with the code
fun getTweets()
etc]
r
Why not use
.share()
?
r
@asad.awadia it’s on https://carbon.now.sh/
@russhwolf i’ve mentioned it on the thread 🙂
👍 1
@edwardwongtl thanks for pointing that out; i’ll look into it.. but if you do have a idea on why that’s happening, please do let me know 🙂
e
Simply because that's how
refcount()
works
refcount
only cares if there is at least one subscriber or not, so if you unsub before the second one kicks in, the number of subscriber will drop from 1 to 0, leading to the termination of the stream
And by the time the second one kicks in,
refcount
notice the number of subscriber jumps from 0 to 1, and it start the stream all over again
r
is it better to use
connect
then?
e
Depends on your use case
r
noted. thank you very much @edwardwongtl 🙂
e
But IMO most of the time using
publish()
with
autoConnect(numberOfSubs)
is more flexible
It allows you to specify the number of subscriber required to start the stream
r
i’ll be sure to doodle around with that; what’s your twitter handle? I’ll give you a shoutout 😄
e
I don't have a twitter account😂, not popular in my area
r
started this 100DaysOfRx to get me focused into trying out Rx everyday and post whatever I’ve learnt… social accountability to get my lazy ass scared 😂
oh! highly recommended to open a twitter account then 😄