Expand description
PlainMessage 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:
NodePlainMessageSender: A flexible sender that uses a callback function for deliveryHttpPlainMessageSender: Sends messages over HTTP with robust error handling and retries
§Cross-platform Support
The HttpPlainMessageSender 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 = PlainMessage {
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: "did:example:sender".to_string(),
to: 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".to_string(),
message
).await?;
// Create an HTTP sender for external dispatch
let sender = HttpPlainMessageSender::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
Plain Message Sender - HTTP message sender implementation for sending messages over HTTP
- Http
Plain Message Sender With Tracking - HTTP message sender with delivery tracking
- Node
Plain Message Sender - Node message sender implementation
- WebSocket
Plain Message Sender - WebSocket message sender implementation for sending messages over WebSockets
Traits§
- Plain
Message Sender - PlainMessage sender trait for sending packed messages to recipients