pub struct HydraClient { /* private fields */ }Expand description
HydraClient connects to the relay server as a producer or consumer, performs handshake, and sends/receives encrypted frames.
It maintains an internal memory pool (18 mb) for zero-copy encryption/decryption and buffering.
The broadcast method allows producers to send encrypted frames to all connected consumers in the same session,
while the recv method allows consumers to receive and decrypt frames from the producer.
Implementations§
Source§impl HydraClient
impl HydraClient
Sourcepub async fn connect_producer(
addr: SocketAddr,
session_id: &[u8; 64],
session_key: [u8; 32],
) -> Result<Self>
pub async fn connect_producer( addr: SocketAddr, session_id: &[u8; 64], session_key: [u8; 32], ) -> Result<Self>
Connects to the relay server, performs handshake, and sends a join frame with the producer role and session_id.
Sourcepub async fn broadcast(&mut self, data: &[u8]) -> Result<()>
pub async fn broadcast(&mut self, data: &[u8]) -> Result<()>
Broadcasts the given data as an encrypted frame to all connected consumers (zero-copy) in the same session.
Sourcepub async fn connect_consumer(
addr: SocketAddr,
session_id: &[u8; 64],
session_key: [u8; 32],
) -> Result<Self>
pub async fn connect_consumer( addr: SocketAddr, session_id: &[u8; 64], session_key: [u8; 32], ) -> Result<Self>
Connects to the relay server, performs handshake, and sends a join frame with the consumer role and session_id.
Auto Trait Implementations§
impl Freeze for HydraClient
impl RefUnwindSafe for HydraClient
impl Send for HydraClient
impl Sync for HydraClient
impl Unpin for HydraClient
impl UnsafeUnpin for HydraClient
impl UnwindSafe for HydraClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more