Expand description
Message sender implementations for TAP Node.
This module provides functionality for sending TAP messages to recipients using various transport mechanisms.
§Overview
The message sender system in TAP Node implements different strategies for delivering DIDComm messages to their recipients. The primary implementations are:
NodeMessageSender: A flexible sender that uses a callback function for deliveryHttpMessageSender: Sends messages over HTTP with robust error handling and retries
§Cross-platform Support
The HttpMessageSender implementation supports multiple platforms:
- Native environments (using reqwest)
- WASM environments (using web-sys)
- Fallback implementations for environments without these libraries
§Usage with TapNode
// Create a TapNode
let node = TapNode::new(NodeConfig::default());
// Create a sample message
let message = Message {
id: "test-123".to_string(),
typ: "https://tap.rsvp/schema/1.0#transfer".to_string(),
type_: "https://tap.rsvp/schema/1.0#transfer".to_string(),
body: json!({"amount": "100.00"}),
from: Some("did:example:sender".to_string()),
to: Some(vec!["did:example:recipient".to_string()]),
created_time: Some(chrono::Utc::now().timestamp() as u64),
expires_time: None,
thid: None,
pthid: None,
attachments: None,
from_prior: None,
extra_headers: Default::default(),
};
// Pack a message using the node's send_message method
let packed_message = node.send_message(
"did:example:sender",
"did:example:recipient",
message
).await?;
// Create an HTTP sender for external dispatch
let sender = HttpMessageSender::new("https://recipient-endpoint.example.com".to_string());
// Send the packed message to the recipient node
sender.send(
packed_message,
vec!["did:example:recipient".to_string()]
).await?;Structs§
- Http
Message Sender - HTTP message sender implementation for sending messages over HTTP
- Node
Message Sender - Node message sender implementation
- WebSocket
Message Sender - WebSocket message sender implementation for sending messages over WebSockets
Traits§
- Message
Sender - Message sender trait for sending packed messages to recipients