> ## Documentation Index
> Fetch the complete documentation index at: https://learn.social.plus/llms.txt
> Use this file to discover all available pages before exploring further.

# Message Receipt Sync

> Start and stop chat message receipt synchronization for an active subchannel.

Use message receipt sync while a user is viewing a chat screen. It subscribes the SDK to receipt updates for a subchannel so read and delivery state can stay current. Stop sync when the user leaves the screen.

<Info>
  This page covers the explicit public receipt-sync APIs. Flutter does not expose `startMessageReceiptSync` or `stopMessageReceiptSync` in the current public SDK surface.
</Info>

## Platform Surface

| Operation  | TypeScript                                                   | iOS                                                                  | Android                                                      | Flutter     |
| ---------- | ------------------------------------------------------------ | -------------------------------------------------------------------- | ------------------------------------------------------------ | ----------- |
| Start sync | `SubChannelRepository.startMessageReceiptSync(subChannelId)` | `AmitySubChannelRepository().startMessageReceiptSync(subChannelId:)` | `subChannelRepository.startMessageReceiptSync(subChannelId)` | Not exposed |
| Stop sync  | `SubChannelRepository.stopMessageReceiptSync(subChannelId)`  | `AmitySubChannelRepository().stopMessageReceiptSync(subChannelId:)`  | `subChannelRepository.stopMessageReceiptSync(subChannelId)`  | Not exposed |
| Result     | `Promise<boolean>` / `boolean`                               | `Void`                                                               | `Completable`                                                | Not exposed |

## Parameters

| Parameter             | Required | Description                                                                                                     |
| --------------------- | -------- | --------------------------------------------------------------------------------------------------------------- |
| `subChannelId`        | Yes      | Subchannel whose message receipt topic should be synchronized.                                                  |
| Active chat lifecycle | Yes      | Start sync when a user enters the message view and stop it when they leave.                                     |
| Channel object        | No       | If you only have a channel, use its default subchannel ID where the platform exposes it.                        |
| Cleanup handle        | Depends  | TypeScript stop is explicit; Android and iOS use explicit stop calls; keep your own screen lifecycle ownership. |

## Start Receipt Sync

Start sync before or while rendering the active message list for a subchannel.

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { SubChannelRepository } from '@amityco/ts-sdk';

  const didStart = await SubChannelRepository.startMessageReceiptSync(
    subChannelId,
  );

  if (didStart) {
    showSuccessMessage(subChannelId);
  }
  ```

  ```swift iOS theme={null}
  let subChannelRepository = AmitySubChannelRepository()

  try await subChannelRepository.startMessageReceiptSync(
      subChannelId: "sub-channel-id"
  )

  showSuccessMessage("sub-channel-id")
  ```

  ```kotlin Android theme={null}
  val subChannelRepository = AmityChatClient.newSubChannelRepository()

  val disposable = subChannelRepository
      .startMessageReceiptSync(subChannelId)
      .subscribe(
          { showSuccessMessage(subChannelId) },
          { error -> handleGeneralError(error) },
      )
  ```
</CodeGroup>

## Stop Receipt Sync

Stop sync when the active chat view closes, changes to another subchannel, or no longer needs live receipt state.

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { SubChannelRepository } from '@amityco/ts-sdk';

  const didStop = SubChannelRepository.stopMessageReceiptSync(subChannelId);

  if (didStop) {
    showSuccessMessage(subChannelId);
  }
  ```

  ```swift iOS theme={null}
  let subChannelRepository = AmitySubChannelRepository()

  try await subChannelRepository.stopMessageReceiptSync(
      subChannelId: "sub-channel-id"
  )

  showSuccessMessage("sub-channel-id")
  ```

  ```kotlin Android theme={null}
  val subChannelRepository = AmityChatClient.newSubChannelRepository()

  val disposable = subChannelRepository
      .stopMessageReceiptSync(subChannelId)
      .subscribe(
          { showSuccessMessage(subChannelId) },
          { error -> handleGeneralError(error) },
      )
  ```
</CodeGroup>

## Implementation Notes

<CardGroup cols={2}>
  <Card title="Screen Owned" icon="window">
    Tie receipt sync to the active chat screen, not to app startup.
  </Card>

  <Card title="Subchannel Scoped" icon="layer-group">
    The public APIs take a `subChannelId`, so resolve the default subchannel from the channel when needed.
  </Card>

  <Card title="Read Marking" icon="check">
    Receipt sync keeps receipt state fresh; use `message.markRead()` to mark messages read.
  </Card>

  <Card title="Unsupported Platforms" icon="circle-alert">
    Do not add Flutter start/stop examples unless the Flutter SDK exposes public APIs for them.
  </Card>
</CardGroup>

## Related Topics

<CardGroup cols={3}>
  <Card title="Message Read Status" href="./message-read-status" icon="eye">
    Mark messages as read.
  </Card>

  <Card title="Message Delivery Status" href="./message-delivery-status" icon="truck">
    Mark delivered and query receipt users.
  </Card>

  <Card title="Channel Unread Count" href="./channel-unread-count" icon="hashtag">
    Show unread count and mention state in channel lists.
  </Card>
</CardGroup>
