kittenipc/README.md
2025-11-08 09:37:30 +03:00

1.2 KiB

Readme draft

  1. write code in language A
  2. annotate it (see below)
  3. launch kitcom -src path/to/source.A -dest path/to/generated/file.B
  4. Use generated file to IPC

Typescript:

Currently only whole classes are supported.

Annotate:

/**
 * @kittenipc api
 */
class ClassName {}

Usage:

const localApi = new LocalAPI(); // LocalAPI is written by hand
const ipc = new ChildIPC(localApi);
const goApi = new RemoteAPI(ipc); // RemoteAPI is generated by kitcom
await ipc.start();
// work
await ipc.wait();

Golang:

Currently only whole structs are supported

Annotate

// kittenipc:api
type StructName struct {
}

Usage:

localApi := LocalAPI{} // LocalAPI is written by hand
cmd := exec.Command(fmt.Sprintf("node %s", "path to compiled js"))
ipc, err := kittenipc.NewParent(cmd, &localApi)
remoteApi := RemoteAPI{Ipc: ipc} // RemoteAPI is generated by kitcom
if err != nil {
		log.Panic(err)
}
if err := ipc.Start(); err != nil {
  log.Panic(err)
}
// work
if err := kit.Wait(); err != nil {
  log.Panic(err)
}

LocalAPI on one side is RemoteAPI on the other side

Library status

Work in progress. No tests, no docs, code is not finished! Not everything is working yet. Code is partly crap.