dcl_rpc/transports/
mod.rs1use async_trait::async_trait;
6
7pub mod error;
8#[cfg(feature = "memory")]
9pub mod memory;
10#[cfg(feature = "websockets")]
11pub mod web_sockets;
12
13pub type TransportMessage = Vec<u8>;
14
15#[derive(Debug)]
16pub enum TransportError {
17 Internal(Box<dyn std::error::Error + Send + Sync>),
22 Closed,
24 NotBinaryMessage,
26}
27
28#[async_trait]
29pub trait Transport: Send + Sync {
30 async fn receive(&self) -> Result<TransportMessage, TransportError>;
31 async fn send(&self, message: TransportMessage) -> Result<(), TransportError>;
32 async fn close(&self);
33}