Skip to main content

call

Function call 

Source
pub async fn call(
    resolve_via: &mut Session,
    id: &KeyPair,
    realm: [u8; 32],
    procedure: &str,
    payload: Value,
    timeout: Duration,
) -> Result<CallResponse, CallError>
Expand description

Resolves procedure’s provider via direct-dial (through resolve_via, used only to query the DHT) and calls it there, in one hop, in a SEPARATE connection from resolve_via. The provider must have advertised via advertise_direct (or the Erlang macula_response:advertise_direct/6,7) — a plain advertise publishes no discoverable record and resolve will return ResolveError::ProcedureNotAdvertised.

The dial itself uses Trust::Insecure (no TLS verification) because trust is enforced at the application layer instead — see the module doc’s “Trust model”. After the dial, the freshly connected session’s own signature-verified HELLO identity is checked against the exact pubkey the signed DHT chain resolved; a mismatch is CallError::TrustViolation, and the call is refused.