title: Method containing a Subscribe is called multiple times, should I unsubscribe old subscriptions each time?
body: <p>I'm building an Angular app with subscriptions. The component is a chat message page where there's a menu of all your chat messages to others and you can click on each person to view the chat messages with that person. Here's one of my functions inside my component  </p>
  
  <pre><code>getAllChatMessages() {
  
    this.chatService
      .getChatMessages(this.currentChatId, this.otherUserId)
      .takeUntil(this.ngUnsubscribe)
      .subscribe(userProfile =&gt; {
        //some logic here
      });
  }
  </code></pre>
  
  <p>Now this <code>getAllChatMessages()</code> function is being called every single time the user clicks on a different person they're chatting with. So in this case, the subscribe is being called multiple times over and over again albeit with different <code>this.currentChatId</code> and <code>this.otherUserId</code>. The <code>takeUntil</code> is only there to unsubscribe when the component is destroyed.</p>
  
  <p>What I'm really not clear is whether the old subscribes are still there while another instance of it is instantiated with the next <code>getAllChatMessages()</code> call. Since each subscribe holds a different resource, should I be unsubscribing to the old subscription every time the <code>getAllChatMessages()</code> is called subsequently?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>If I do need to clear out old subscriptions, I'm probably looking at something like this? This way on every subsequent call, I'm removing and unsubscribing the subscription from the last call of <code>getAllChatMessages()</code>.</p>
  
  <pre><code>getAllChatMessages() {
    if (this.getChatMsgSub) {
      this.getChatMsgSub.unsubscribe();
    }
  
    this.getChatMsgSub = this.chatService
      .getChatMessages(this.currentChatId, this.otherUserId)
      .takeUntil(this.ngUnsubscribe)
      .subscribe(userProfile =&gt; {
        //some logic here
      });
    }
  </code></pre>