pub trait DeliveryService:
Send
+ Sync
+ 'static {
// Required methods
fn send(&self, pkt: OutboundPacket) -> Result<String, DeliveryServiceError>;
fn subscribe(&self) -> Receiver<InboundPacket>;
}Required Methods§
Sourcefn send(&self, pkt: OutboundPacket) -> Result<String, DeliveryServiceError>
fn send(&self, pkt: OutboundPacket) -> Result<String, DeliveryServiceError>
Send a packet to the network and return a transport message id (if available).
Sourcefn subscribe(&self) -> Receiver<InboundPacket>
fn subscribe(&self) -> Receiver<InboundPacket>
Subscribe to inbound packets.
Each call creates a new channel and registers its sender internally. Senders are pruned when the corresponding receiver is dropped, but only during the next inbound event dispatch. Avoid calling this in a loop without dropping previous receivers.