Repository navigation
v0.2.0 — multi-peer enumeration + binary stream payloads
New — meaningful-implementation phase additions on top of the v0.1.x MVP:
endpointConnections(endpoint)— sync list of every active peer connection handle, for broadcast/fan-outconnNodeId(conn)— sync remote-peer node id lookupstreamWriteBuffer(stream, buffer)— binary-safe variant of streamWritestreamReadToEndBuffer(stream, maxBytes)— binary-safe variant of streamReadToEnd
Together these unlock real-world P2P use cases: chat broadcast, file transfer, encrypted protocol payloads — all without UTF-8 round-tripping or external bookkeeping.
// Server: broadcast to every connected peer
for (const c of iroh.endpointConnections(ep)) {
console.log("→", iroh.connNodeId(c));
const stream = await iroh.openBi(c);
await iroh.streamWriteBuffer(stream, payload); // raw bytes
await iroh.streamFinish(stream);
}3 new unit tests for the conn-index logic.
Connection-event callbacks (endpoint.on('connection', cb)) deferred — polling via acceptOne + endpointConnections covers the broadcast use case today; event-driven listeners need a wrapper-specific GC scanner + main-thread event pump.