Struct reactive_messaging::SocketClient
source · pub struct SocketClient { /* private fields */ }Expand description
The handle to define, start and shutdown a Reactive Client for Socket Connections
Implementations§
source§impl SocketClient
impl SocketClient
sourcepub async fn spawn_responsive_processor<ServerMessages: SocketServerDeserializer<ServerMessages> + Send + Sync + PartialEq + Debug + 'static, ClientMessages: SocketServerSerializer<ClientMessages> + Send + Sync + PartialEq + Debug + 'static, ConnectionEventsCallbackFuture: Future<Output = ()> + Send, ClientStreamType: Stream<Item = ClientMessages> + Send + 'static>(
ip: String,
port: u16,
connection_events_callback: impl Fn(ConnectionEvent<ClientMessages>) -> ConnectionEventsCallbackFuture + Send + Sync + 'static,
processor_stream_builder: impl Fn(String, u16, Arc<Peer<ClientMessages>>, ProcessorRemoteStreamType<ServerMessages>) -> ClientStreamType + Send + Sync + 'static
) -> Result<Self, Box<dyn Error + Sync + Send>>
pub async fn spawn_responsive_processor<ServerMessages: SocketServerDeserializer<ServerMessages> + Send + Sync + PartialEq + Debug + 'static, ClientMessages: SocketServerSerializer<ClientMessages> + Send + Sync + PartialEq + Debug + 'static, ConnectionEventsCallbackFuture: Future<Output = ()> + Send, ClientStreamType: Stream<Item = ClientMessages> + Send + 'static>( ip: String, port: u16, connection_events_callback: impl Fn(ConnectionEvent<ClientMessages>) -> ConnectionEventsCallbackFuture + Send + Sync + 'static, processor_stream_builder: impl Fn(String, u16, Arc<Peer<ClientMessages>>, ProcessorRemoteStreamType<ServerMessages>) -> ClientStreamType + Send + Sync + 'static ) -> Result<Self, Box<dyn Error + Sync + Send>>
Spawns a task to connect to the server @ ip & port and returns, immediately,
an object through which the caller may inquire some stats (if opted in) and request
the client to disconnect.
The given dialog_processor will produce non-futures & non-fallibles ClientMessages that will be sent to the server.
pub fn is_connected(&self) -> bool
pub fn shutdown(self) -> Result<(), Box<dyn Error>>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for SocketClient
impl Send for SocketClient
impl Sync for SocketClient
impl Unpin for SocketClient
impl !UnwindSafe for SocketClient
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