Raw
Pass bytes directly. The application owns framing and every validation rule.
14.0.0 · Rust 1.85+
The Rust crate implements the node-ipc event envelope and delimiter framing with blocking native transports and no runtime or build dependencies.
[dependencies]
node-ipc = "=14.0.0"Version 14 is the first paired Node.js and Rust release. The crate requires Rust 1.85 or newer. Its only development dependency is exact vanilla-test 2.1.0; production remains dependency-free.
use node_ipc::{tcp, CodecConfig, Connection, Event, Message};
fn main() -> node_ipc::Result<()> {
let stream = tcp::connect(("127.0.0.1", 9763))?;
let mut connection = Connection::new(stream, CodecConfig::fast())?;
connection.send(&Event::new("example.request", "hello"))?;
if let Some(Message::Event(response)) = connection.recv()? {
println!("{}", response.data.to_json_string());
}
Ok(())
}Connection<S> works over a TCP stream, Unix stream, Windows named pipe, or caller-supplied TLS stream when S implements Read + Write.
| Transport | Rust implementation | Boundary |
|---|---|---|
| TCP | Blocking standard-library client and listener | Reliable ordered bytes; no identity or confidentiality |
| UDP4 / UDP6 | Native datagrams with peer-isolated fragment state | Application owns loss, ordering, authentication, and rate limits |
| Unix local | Unix-domain streams with conservative endpoint cleanup | Application owns secure parent-directory and peer policy |
| Windows local | Byte-mode named pipes through narrow Win32 bindings | Application must create and verify any required ACL |
| TLS | Generic Read + Write integration boundary | Application selects TLS, verifies identity, and authorizes the peer |
Pass bytes directly. The application owns framing and every validation rule.
Encode and decode the canonical JSON event envelope with delimiter framing.
Add frame, event-name, reserved-name, per-frame write, and incomplete-frame limits.
Add an event allow-list. Transport authentication is still caller-owned.
max_pending_bytes is a per-frame write ceiling, not a measurement of Node.js-style queued socket writes.
The Rust codec cannot prove the identity or authorization of a caller-supplied transport. Network use requires application-supplied verified mTLS; local use requires application-verified endpoint ownership and access control.
This release has no browser adapter, WASM ABI, WASM build, or browser test path. Rust/WASM would not unlock raw browser sockets by itself.
Normal framed messages interoperate with Node.js. Review number precision, duplicate members, Unicode, malformed JSON, delimiter, and incomplete-frame boundaries before sharing language-specific values.
Read the exact contract →