patchbay_transport 0.4.1 copy "patchbay_transport: ^0.4.1" to clipboard
patchbay_transport: ^0.4.1 copied to clipboard

Optional direct HTTP/JSON debug transport for Patchbay: explicitly started, loopback by default, short-lived bearer auth, fail-closed surface.

example/patchbay_transport_example.dart

import 'dart:io';

import 'package:patchbay_transport/patchbay_transport.dart';

Future<void> main() async {
  const identity = PatchbayDirectIdentity(
    schemaVersion: 1,
    applicationId: 'com.example.app',
    appInstanceId: 'example-instance',
  );
  final host = PatchbayDirectHost(
    handlers: PatchbayDirectHandlers(
      identity: () async => identity,
      catalog: () async => const <String, Object?>{'commands': <Object?>[]},
      snapshot: ([request]) async => const <String, Object?>{},
      invoke: (command, arguments, requestId) async => <String, Object?>{
        'requestId': requestId,
        'accepted': true,
      },
    ),
  );

  final session = await host.start();
  final client = PatchbayDirectClient(session: session);
  try {
    stdout.writeln(await client.identity());
  } finally {
    client.close(force: true);
    await host.stop();
  }
}
0
likes
0
points
408
downloads

Publisher

unverified uploader

Weekly Downloads

Optional direct HTTP/JSON debug transport for Patchbay: explicitly started, loopback by default, short-lived bearer auth, fail-closed surface.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on patchbay_transport