Publish to wire


The WireAPI.PublishWire API enables clients to publish to a wire.


Use the wire command.

Terminal window
./volt wire --help

Publish to a wire using the cli wire command:

Terminal window
./volt wire <wire id>

The wire data is read from STDIN. This enables flows such as:

Terminal window
curl | ./volt wire @demo-wire
cat somefile | ./volt wire @demo-wire
./volt wire @demo-wire < anotherfile


Navigate to the wire in the resource explorer and use the ‘publish’ button on the bottom panel, which contains a ‘microphone’ icon.


Use the PublishWire API write data to the wire.


const pub = voltApi.PublishWire({ wire_id: "@demo-wire" });
pub.on("error", (err) => console.error(err.message));
pub.on("data", (response) => console.log(response));
pub.on("end", () => console.log("publication ended"));
pub.send({ chunk: "hello" });
pub.send({ chunk: "world" });


volt_client::WirePublishCallbacks publishCallbacks;
volt_client::WirePublishClient* publishRpc = nullptr;
publishCallbacks.onEnd = [](bool serverSide) {
// Publish call ended.
publishCallbacks.onResponse =
[](tdx::volt_api::volt::v1::PublishResponse const& response) {
if (response.has_status() &&
response.status().message() != error_code::ok) {
// Publication ended with an error.
} else {
// Publication ended OK.
publishCallbacks.onDestroyed = [](tdx::grpc::CallClientBase* rpcClient) {
// Publication RPC has died.
// Start the publish RPC.
if ((result = volt()->serviceApi()->publishWire(
publishCallbacks, &publishRpc)) != error_code::ok) {
// Failed to start wire publish RPC
return result;
// Send the initial request containing the wire id.
tdx::volt_api::volt::v1::PublishRequest startReq;