title: How to create proper queue in RxJS consisting of Observables containing both sync and async functions
body: <p>My application receives responses from a server. These responses may be received singly or in multiples, but they'll always be received in the order they should be individually dealt with and rendered.</p>
  
  <p>Upon receiving a response, the following things need to happen, in order:</p>
  
  <ol>
  <li>A typing indicator is rendered and displayed (sync)</li>
  <li>The response data is parsed and massaged into the correct format (sync)</li>
  <li>An artificial delay is run to emulate a "real person" typing (async)</li>
  <li>The typing indicator should be removed/hidden (sync)</li>
  <li>The formatted response is rendered to the screen (sync)</li>
  </ol>
  
  <p>Now, all of these steps need to occur in order for EACH response received, ALSO in order. The end result of this should be typing indicators being shown for a random amount of time, then disappearing, then the response being shown, then the indicator being shown again for a random amount of time, then disappearing, then the next response being shown, etc.</p>
  
  <p>I've tried a variety of techniques for accomplishing this with RxJS but I'm struggling to get this to work. I'm finding that regardless of my approach, responses (added to a queue-like structure and/or executed sequentially) keep firing off the chain of events concurrently. I cannot figure out how to execute the chain of events sequentially AND wait for each previous chain of events to be completed before the next begins.</p>
  
  <p>I've attempted solutions using a <code>.pipe</code> chain containing <code>.tap</code> and <code>.concatMap</code> functions, as well as creating a queue from <code>new Subject()</code> and adding new items to it to be executed using <code>next()</code>. None of these things solves my problem.</p>
  
  <p>It's essential that the core construct be a queue of some sort that I can continue adding items to and they'll automatically be executed when the queue is finished/empty.</p>