Docs›qos-sdk›write_output
qos-sdk Reference

qos_sdk::output::write

Sends the final receipt payload from the WASM module back to the host, which is then routed to the guest's Micro-UI and the Admin HUD via an EXECUTION_RECEIPT WebSocket event.

#Signature

pub fn write(data: &[u8])

#Usage

The data passed to output::write should typically be a JSON-encoded string. Once written, the module should normally return immediately.

src/lib.rs
use qos_sdk::output;

#[no_mangle]
pub extern "C" fn run() -> i32 {
    // Construct receipt
    let receipt = br#"{"status":"success","message":"Checked in"}"#;
    
    // Write back to host
    output::write(receipt);
    
    // Return 0 for success
    0
}