title: Idiomatic way to handle a stream end with RxJS
body: <p>I need to do a some action when stream ends. What the idiomatic way to do that?</p>
  
  <p>Now I use the code bellow:</p>
  
  <pre><code>source.subscribe(undefined, undefined, function() {
    socket.send({type: 'end'});
  });
  </code></pre>