pub struct WebSocketTransport { /* private fields */ }Expand description
WebSocket transport for iFlow communication
This class provides a low-level WebSocket interface for communicating with iFlow. It handles connection management, message serialization, and error recovery.
Implementations§
Source§impl WebSocketTransport
impl WebSocketTransport
Sourcepub fn new(url: String, timeout: f64) -> Self
pub fn new(url: String, timeout: f64) -> Self
Initialize WebSocket transport
§Arguments
url- WebSocket URL (e.g., ws://localhost:8090/acp?peer=iflow)timeout- Connection timeout in seconds
Sourcepub async fn connect(&mut self) -> Result<()>
pub async fn connect(&mut self) -> Result<()>
Establish WebSocket connection
§Returns
Ok(())if the connection was successfulErr(IFlowError)if the connection failed
Sourcepub async fn receive(&mut self) -> Result<String>
pub async fn receive(&mut self) -> Result<String>
Receive messages from WebSocket
This method receives a single message from the WebSocket connection.
§Returns
Ok(String)containing the received messageErr(IFlowError)if there was an error
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Auto Trait Implementations§
impl !Freeze for WebSocketTransport
impl !RefUnwindSafe for WebSocketTransport
impl Send for WebSocketTransport
impl Sync for WebSocketTransport
impl Unpin for WebSocketTransport
impl !UnwindSafe for WebSocketTransport
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