Skip to main content

vibe_ipc 0.1.1 copy "vibe_ipc: ^0.1.1" to clipboard
vibe_ipc: ^0.1.1 copied to clipboard

Single-instance local IPC for Dart desktop apps. Unix socket, schema-validated requests, retry-safe ids, ready ack and start-if-closed.

example/vibe_ipc_example.dart

import 'package:vibe_ipc/vibe_ipc.dart';

/// Run once to start the server, and again with an argument to send to it:
///   dart run example/vibe_ipc_example.dart
///   dart run example/vibe_ipc_example.dart "hello"
Future<void> main(List<String> args) async {
  final path = defaultSocketPath('vibe-ipc-example');
  if (args.isEmpty) {
    final server = IpcServer(
      path,
      IpcSchema({
        'say': (a) => a['text'] is String ? {'text': a['text']} : null,
      }),
      (r) async {
        print('got: ${r.args['text']}');
        return IpcResponse(r.id, true, 'ok', text: 'printed');
      },
    );
    await server.start();
    print('listening on $path (Ctrl+C to stop)');
  } else {
    final launcher =
        IpcLauncher(IpcClient(path), () async => throw 'not started');
    final out = await launcher
        .deliver(IpcRequest(launcher.newId(), 'say', {'text': args.join(' ')}));
    print('${out.ok} ${out.code} ${out.text}');
  }
}
0
likes
160
points
0
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Single-instance local IPC for Dart desktop apps. Unix socket, schema-validated requests, retry-safe ids, ready ack and start-if-closed.

Repository (GitHub)
View/report issues

Topics

#ipc #sockets #desktop #linux

License

MIT (license)

More

Packages that depend on vibe_ipc