# Observe reading count

The SDK provides the startMessageReceiptSync() function to enable the observation of reading/delivered status within the chatroom. It is essential to initiate this functionality to receive real-time updates on message read/delivered counts. If the client doesn't start observing, it won't receive any updates regarding the read/delivered count.

Note: Observing reading status consumes real-time event topics. Therefore, it is recommended to stop observing when the user exits the chatroom using stopMessageReceiptSync().

### Starting Observation

To start observing reading status, call the startMessageReceiptSync() function:

{% tabs %}
{% tab title="iOS" %}
{% embed url="<https://gist.github.com/amythee/98825a7acd668f8019b2810d8a96bd44>" %}
{% endtab %}

{% tab title="Android" %}
{% embed url="<https://gist.github.com/amythee/255c7a568c5e14c68dd7f64f99a617f1>" %}
{% endtab %}
{% endtabs %}

This action ensures that the client receives real-time updates on the reading/delivered status of messages in the chatroom.

### Stopping Observation

When the user exits the chatroom or when observation is no longer required, it is crucial to stop observing reading status to conserve resources and prevent unnecessary real-time event consumption. Use the stopMessageReceiptSync() function for this purpose:

{% tabs %}
{% tab title="iOS" %}
{% embed url="<https://gist.github.com/amythee/c0a81b61c644bd69780fe44d7663b0bf>" %}
{% endtab %}

{% tab title="Android" %}
{% embed url="<https://gist.github.com/amythee/eb9b376fde7fe9fe1a974180e0071aa9>" %}
{% endtab %}
{% endtabs %}

Stopping observation ensures that the client no longer receives real-time updates on message read/delivered counts.

### Best Practices

* Lifecycle Management: Start observing reading status when the user enters the chatroom and stop observing when the user exits to optimize resource usage.
* Real-time Event Topics: Be mindful that observing reading status consumes real-time event topics, and unnecessary observation can lead to reaching the limit quota to receive real-time events in the SDK.
* Resource Optimization: Stop observation when it is no longer required to conserve resources and improve overall performance.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.social.plus/social-plus-sdk/chat/channels/unread-count/observe-reading-count.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
