title: Unsubscribe subscription in Apollo Client
body: <p>In my component, I have this code:</p>
  
  <pre><code>componentDidMount () {
    // Setup subscription listener
    const { client, match: { params: { groupId } } } = this.props
    client.subscribe({
      query: HOMEWORK_IN_GROUP_SUBSCRIPTION,
      variables: { groupId },
    }).subscribe({
      next ({ data }) {
        const cacheData = client.cache.readQuery({
          query: GET_GROUP_QUERY,
          variables: { groupId },
        })
  
        const homeworkAlreadyExists = cacheData.group.homeworks.find(
          homework =&gt; homework._id == data.homeworkInGroup._id
        )
        if (!homeworkAlreadyExists) {
          client.cache.writeQuery({
            query: GET_GROUP_QUERY,
            variables: { groupId },
            data: { ...cacheData,
              group: { ...cacheData.group,
                homeworks: [ ...cacheData.group.homeworks,
                  data.homeworkInGroup,
                ],
              },
            },
          })
        }
      },
    })
  }
  </code></pre>
  
  <p>The problem is that this component will re-subscribe when mounted and will mantain subscribed even if unmounted.</p>
  
  <p>How can I unsubscribe my component?</p>