subscribeToPotentialDataChanges method

  1. @override
UnsubscribeFunction subscribeToPotentialDataChanges(
  1. PotentialChangeCallback callback
)
override

Satellite processes subscribe to these "data has potentially changed" notifications. When they get one, they check the _oplog table in the database for actual changes persisted by the triggers.

Implementation

@override
UnsubscribeFunction subscribeToPotentialDataChanges(
  PotentialChangeCallback callback,
) {
  void wrappedCallback(PotentialChangeNotification notification) {
    if (_hasDbName(notification.dbName)) {
      callback(notification);
    }
  }

  final eventListener =
      EventListener(EventNames.potentialDataChange, wrappedCallback);

  _subscribe(eventListener);

  return () => _unsubscribe(eventListener);
}