programSubscribe method

Future<WebsocketSubscription<ProgramAccount>> programSubscribe(
  1. Pubkey programId, {
  2. WebsocketOnDataHandler<ProgramAccount>? onData,
  3. WebsocketOnErrorHandler? onError,
  4. WebsocketOnDoneHandler? onDone,
  5. bool cancelOnError = false,
  6. Duration? timeLimit,
  7. ProgramSubscribeConfig? config,
})

Subscribes to a program to receive notifications when the lamports or data for an account owned by the given program changes.

Implementation

Future<WebsocketSubscription<ProgramAccount>> programSubscribe(
  final Pubkey programId, {
  final WebsocketOnDataHandler<ProgramAccount>? onData,
  final WebsocketOnErrorHandler? onError,
  final WebsocketOnDoneHandler? onDone,
  final bool cancelOnError = false,
  final Duration? timeLimit,
  final ProgramSubscribeConfig? config,
}) =>
    subscribe(
      ProgramSubscribe(programId, config: config),
      _contextDecoder(ProgramAccount.fromJson),
      onData: onData,
      onError: onError,
      onDone: onDone,
      timeLimit: timeLimit,
      cancelOnError: cancelOnError,
    );