Use case of Observable .do() operator (rxjs)
<h3> Context :</h3>
<p>I'm building an angular 2 app (with a Firebase API). I'm using the AngularFire module. I was wondering how I can mix the <code>canActivate</code> method with the AngularFire auth Observable, and I found <a href="https://github.com/angular/angularfire2/issues/282" rel="noreferrer">this post</a>. The answer is to make the <code>canActivate</code> method returns an <code>Observable&lt;boolean&gt;</code> :</p>
<pre><code>canActivate(): Observable&lt;boolean&gt; {
  return this.auth
    .take(1)
    .map((authState: FirebaseAuthState) =&gt; !!authState)
    .do(authenticated =&gt; {
      if (!authenticated) this.router.navigate(['/login']);
    });
}
</code></pre>
<p>It's the first time I see the Observable <code>do</code> operator, and I can't understand what it really does ? The official doc didnt help me, and I didn't found decent examples.</p>
<h3>Question:</h3>
<p>Can someone bring here some examples of <code>.do()</code> usage ? And difference with <code>.subscribe()</code> ?</p>