Skip to main content

Module control

Module control 

Source
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

  1. Child creates pipe listener
  2. Child sends $init via stdout (JSON-RPC)
  3. Parent validates schema
  4. Parent connects to pipe
  5. 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§

EventDef
Event definition (legacy).
EventSchema
Event definition with ID.
InitMessage
The $init message (legacy struct, prefer build_init_message).
InitParams
Parameters for the $init message (legacy).
InitSchema
Schema describing available methods and events.
MethodDef
Method definition (legacy).
MethodSchema
Method definition with ID and response type.
Schema
Schema (legacy, prefer InitSchema).

Enums§

ResponseType
Response type for a method.

Constants§

PROTOCOL_VERSION
Protocol version string.

Functions§

build_init_message
Build the $init JSON-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).