userOffline property Null safety

UserOfflineCallback? userOffline
read / write

Occurs when a remote user (ChannelProfile.Communication) or a broadcaster (ChannelProfile.LiveBroadcasting) leaves the channel.

There are two reasons for users to become offline:

  • Leave the channel: When the user/broadcaster leaves the channel, the user/broadcaster sends a goodbye message. When this message is received, the SDK determines that the user/host leaves the channel.
  • Go offline: When no data packet of the user or broadcaster is received for a certain period of time (around 20 seconds), the SDK assumes that the user/broadcaster drops offline. A poor network connection may lead to false detections, so we recommend using the Agora RTM SDK for reliable offline detection.

The UserOfflineCallback typedef includes the following parameters:

  • int uid: ID of the user or host who leaves the channel or goes offline.
  • UserOfflineReason reason: Reason why the user goes offline.


UserOfflineCallback? userOffline;