Struct mpc_relay_client::Client
source · pub struct Client { /* private fields */ }
Expand description
Relay service websocket client.
Implementations§
source§impl NativeClient
impl NativeClient
sourcepub async fn new(
server: &str,
options: ClientOptions
) -> impl Future<Output = Result<(NativeClient, EventLoop<Message, Error, SplitStream<WebSocketStream<MaybeTlsStream<TcpStream>>>, SplitSink<WebSocketStream<MaybeTlsStream<TcpStream>>, Message>>), Error>>
pub async fn new( server: &str, options: ClientOptions ) -> impl Future<Output = Result<(NativeClient, EventLoop<Message, Error, SplitStream<WebSocketStream<MaybeTlsStream<TcpStream>>>, SplitSink<WebSocketStream<MaybeTlsStream<TcpStream>>, Message>>), Error>>
Create a new native client.
Trait Implementations§
source§impl Clone for NativeClient
impl Clone for NativeClient
source§fn clone(&self) -> NativeClient
fn clone(&self) -> NativeClient
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl From<NativeClient> for Transport
impl From<NativeClient> for Transport
source§fn from(value: NativeClient) -> Transport
fn from(value: NativeClient) -> Transport
Converts to this type from the input type.
source§impl NetworkTransport for NativeClient
impl NetworkTransport for NativeClient
source§fn public_key(&self) -> &[u8] ⓘ
fn public_key(&self) -> &[u8] ⓘ
The public key for this client.
source§fn connect<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
NativeClient: 'async_trait,
fn connect<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, NativeClient: 'async_trait,
Perform initial handshake with the server.
source§fn connect_peer<'life0, 'life1, 'async_trait>(
&'life0 mut self,
public_key: &'life1 [u8]
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
NativeClient: 'async_trait,
fn connect_peer<'life0, 'life1, 'async_trait>( &'life0 mut self, public_key: &'life1 [u8] ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, NativeClient: 'async_trait,
Handshake with a peer.
Peer already exists error is returned if this client is already connecting to the peer.
source§fn send_json<'life0, 'life1, 'life2, 'async_trait, S>(
&'life0 mut self,
public_key: &'life1 [u8],
payload: &'life2 S,
session_id: Option<Uuid>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
S: Serialize + Send + Sync + 'async_trait + ?Sized,
NativeClient: 'async_trait,
fn send_json<'life0, 'life1, 'life2, 'async_trait, S>( &'life0 mut self, public_key: &'life1 [u8], payload: &'life2 S, session_id: Option<Uuid> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, S: Serialize + Send + Sync + 'async_trait + ?Sized, NativeClient: 'async_trait,
Send a JSON message to a peer via the relay service.
source§fn send_blob<'life0, 'life1, 'async_trait>(
&'life0 mut self,
public_key: &'life1 [u8],
payload: Vec<u8, Global>,
session_id: Option<Uuid>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
NativeClient: 'async_trait,
fn send_blob<'life0, 'life1, 'async_trait>( &'life0 mut self, public_key: &'life1 [u8], payload: Vec<u8, Global>, session_id: Option<Uuid> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, NativeClient: 'async_trait,
Send a binary message to a peer via the relay service.
source§fn new_session<'life0, 'async_trait>(
&'life0 mut self,
participant_keys: Vec<Vec<u8, Global>, Global>,
session_id: Option<Uuid>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
NativeClient: 'async_trait,
fn new_session<'life0, 'async_trait>( &'life0 mut self, participant_keys: Vec<Vec<u8, Global>, Global>, session_id: Option<Uuid> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, NativeClient: 'async_trait,
Create a new session.
source§fn register_connection<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
session_id: &'life1 Uuid,
peer_key: &'life2 [u8]
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
NativeClient: 'async_trait,
fn register_connection<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, session_id: &'life1 Uuid, peer_key: &'life2 [u8] ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, NativeClient: 'async_trait,
Register a peer connection in a session.
source§fn close_session<'life0, 'async_trait>(
&'life0 mut self,
session_id: Uuid
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
NativeClient: 'async_trait,
fn close_session<'life0, 'async_trait>( &'life0 mut self, session_id: Uuid ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, NativeClient: 'async_trait,
Close a session.
source§fn broadcast_json<'life0, 'life1, 'life2, 'life3, 'async_trait, S>(
&'life0 mut self,
session_id: &'life1 Uuid,
recipient_public_keys: &'life2 [Vec<u8, Global>],
payload: &'life3 S
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
S: Serialize + Send + Sync + 'async_trait + ?Sized,
NativeClient: 'async_trait,
fn broadcast_json<'life0, 'life1, 'life2, 'life3, 'async_trait, S>( &'life0 mut self, session_id: &'life1 Uuid, recipient_public_keys: &'life2 [Vec<u8, Global>], payload: &'life3 S ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, S: Serialize + Send + Sync + 'async_trait + ?Sized, NativeClient: 'async_trait,
Broadcast a JSON message in the context of a session.
source§fn broadcast_blob<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
session_id: &'life1 Uuid,
recipient_public_keys: &'life2 [Vec<u8, Global>],
payload: Vec<u8, Global>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
NativeClient: 'async_trait,
fn broadcast_blob<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, session_id: &'life1 Uuid, recipient_public_keys: &'life2 [Vec<u8, Global>], payload: Vec<u8, Global> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, NativeClient: 'async_trait,
Broadcast a binary message in the context of a session.
Auto Trait Implementations§
impl !RefUnwindSafe for NativeClient
impl Send for NativeClient
impl Sync for NativeClient
impl Unpin for NativeClient
impl !UnwindSafe for NativeClient
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