Expand description
Control plane module - $init message and stdio I/O.
The control plane uses JSON over stdio for the initial handshake. After handshake, all communication happens on the data plane (pipe).
§Workflow
- Child creates pipe listener
- Child sends
$initvia stdout (JSON-RPC) - Parent validates schema
- Parent connects to pipe
- Binary communication begins on data plane
§Example
ⓘ
use procwire_client::control::{build_init_message, write_stdout_line, InitSchema, ResponseType};
use procwire_client::transport::generate_pipe_path;
// Create schema
let mut schema = InitSchema::new();
schema.add_method("echo", 1, ResponseType::Result);
// Send $init
let pipe_path = generate_pipe_path();
let init_msg = build_init_message(&pipe_path, &schema);
write_stdout_line(&init_msg)?;Structs§
- Event
Def - Event definition (legacy).
- Event
Schema - Event definition with ID.
- Init
Message - The
$initmessage (legacy struct, preferbuild_init_message). - Init
Params - Parameters for the
$initmessage (legacy). - Init
Schema - Schema describing available methods and events.
- Method
Def - Method definition (legacy).
- Method
Schema - Method definition with ID and response type.
- Schema
- Schema (legacy, prefer
InitSchema).
Enums§
- Response
Type - Response type for a method.
Constants§
- PROTOCOL_
VERSION - Protocol version string.
Functions§
- build_
init_ message - Build the
$initJSON-RPC message. - write_
stdout_ json - Write a JSON value to stdout as a single line.
- write_
stdout_ line - Write a line to stdout (Control Plane).