Skip to main content

Crate simploxide_ws_core

Crate simploxide_ws_core 

Source
Expand description

A fully asynchronous raw SimpleX websocket client that provides:

  1. Requests batching under a heavy load.

  2. Complete asynchonisity: futures created by the same instance of a client are fully independent from each other. The event queue receives events independently from client actions.

  3. Graceful shutdown with strong guarantees:

    • All futures scheduled before the .disconnect call are guaranteed to receive their responses. All futures scheduled after the .disconnect call are guaranteed to receive the tungstenite::Error::AlreadyClosed error.

    • If the web socket connection drops due to an error all buffered responses are guaranteed to be delivered to corresponding futures. All other pending futures are guaranteed to be resolved with the web socket error.

    • You will receive events for as long as there are futures awaiting responses. After all futures are resolved you will receive all buffered events and then the event queue will be closed.

See README on GitHub for diagrams demonstrating how all this works under the hood.


Current implementation heavily depends on tokio runtime and won’t work with other executors.

Re-exports§

pub use tokio_tungstenite;
pub use tokio_tungstenite::tungstenite;

Modules§

clicli

Structs§

EventQueue
An event queue buffers events if you’re not actively processing them so it’s recommended to drop it as soon as it no longer needed.
RawClient
A lightweight cheaply clonable client capable of sending raw requests(SimpleX commands) and receiving raw responses(JSON objects).
SimplexVersion
Parses SimpleX version numbers in the form MAJOR.MINOR.PATCH.HOTFIX.

Enums§

VersionError

Functions§

connect
Connect to the running SimpleX daemon by websocket URI.

Type Aliases§

Error
Event
EventReceiver
RawEventQueue
Response
Result