monitorStatus method

Stream<String> monitorStatus(
  1. String userId
)

Đăng ký theo dõi trạng thái

Implementation

Stream<String> monitorStatus(String userId) {
  _updateLastActivity();

  if (!_statusControllers.containsKey(userId)) {
    _statusControllers[userId] = StreamController<String>.broadcast();

    // Lấy thông tin ban đầu nếu chưa có
    if (!_statusCache.containsKey(userId)) {
      _fetchStatus(userId);
    } else {
      // Thông báo với cache hiện tại
      _notifyStatusChange(userId);
    }
  }

  return _statusControllers[userId]!.stream;
}