title: RxJs Observable Pagination
body: <p>First: This is the first project in which I am using RxJs, I thought I will learn best by using it.</p>
  
  <p>I found this answer: <a href="https://stackoverflow.com/questions/27514310/turning-paginated-requests-into-an-observable-stream-with-rxjs">Turning paginated requests into an Observable stream with RxJs</a> 
  But it says in the comments: </p>
  
  <blockquote>
    <p>You're exceeding the maximum call stack still. At around 430 pages returned. I think recursion might not be the best solution here</p>
  </blockquote>
  
  <p>I want to query the Youtube Data API, the results come back in pages and I need to paginate through them.
  I imagined a work flow like this could work:
  1)Initiate a call
  2)Check if the response has a 'nextPageToken'
  3)If it has, do another request to the Youtube API
  4)If not, finish</p>
  
  <pre><code>So to do this I could Imagine the following Observables / streams:
  FirstRequestStream -A-X---------------&gt;
  ResponseStream     -A-A-A-A--X--------&gt;
  RequestStream      -I-A-I-A-----------&gt;
  A = Action
  I = Info from upper stream
  X = Termination
  </code></pre>
  
  <p>(Not sure if this diagram is correct the way I made it)</p>
  
  <p>So the ResponseStream depends on FirstRequestStream and RequestStream(using the merge function). The RequestStream depends on the ResponseStream( is this called a circulating observable ?) </p>
  
  <p>-Is this the right approach ? </p>
  
  <p>-Are 'circulating observables' a good thing, are they even possible ?(I had problems creating one).  </p>
  
  <p>-Any other way I should try first?</p>
  
  <p>-Is it possible to create interdependent observable streams ? </p>
  
  <p>Thank you for your help. </p>