title: How do I sequentially loop an observable in RxSwift?
body: <p>I am trying to create a stream that polls a network service. At the moment it queries the service then completes after a short delay. I'd like the onward stream to restart rather than completing thereby polling the service forever.</p>
  
  <p>You could do something like ...</p>
  
  <pre><code>myPollingStream.repeat()
  </code></pre>
  
  <p>But <code>repeat</code> in RxSwift is actually <code>repeatElement</code> and so actually generates a stream of observables. You could possibly <code>concatMap</code> these into a flattened serial sequence but RxSwift does not have the <code>concatMap</code> operator.</p>
  
  <p>So how do I loop an observable in RxSwift?</p>
  
  <p>I'd like the requests to be sequential, not concurrent so <code>flatMap</code> is not an option since it merges streams leading to overlapping requests. I'm looking for something similar to how <code>retry()</code> works but restarting <code>onComplete</code> not <code>onError</code></p>