pub struct RawClient { /* private fields */ }Expand description
A lightweight cheaply clonable client capable of sending raw requests(SimpleX commands) and getting raw responses(JSON objects).
You can use the client behind a shared reference, or you can clone it, in both cases the created futures will be indpenendent from each other.
Implementations§
Source§impl RawClient
impl RawClient
Sourcepub async fn send(&self, command: String) -> Result<Response>
pub async fn send(&self, command: String) -> Result<Response>
Send a raw SimpleX request that is a SimpleX CLI command.
The actual request sending part always resolves immediately so the send(..).await call
directly awaits the response.
Sourcepub fn disconnect(self)
pub fn disconnect(self)
Drops the current client and initiates a graceful shutdown for the underlying web socket connection.
If there are multiple instances of the client all futures scheduled before this call will
still receive their responses but all new Self::send futures will immediately resolve
with tungstenite::Error::AlreadyClosed.