Expand description
A simple wrapper for the Meteor DDP protocol.
let connection = siderite::Connection::connect("wss://example.com/websocket").await?;
// Make a RPC task in an independant task:
let handle = connection.handle();
tokio::spawn(async move {
let r = handle.call("login", vec!["username".into(), "my-secret-token".into()])
.await?; // this throws if the RPC call could not complete
.map_err(|e| eprintln!("Login failed with reason: {}", e))?
...
});
// Consume the stream
while let Some(msg) = connection.recv().await {
match msg {
ServerMessage::Added{..} => { ... }
}
}
Re-exports§
pub use connection::Connection;
pub use connection::Handle;
pub use protocol::ClientMessage;
pub use protocol::ServerMessage;
pub use protocol::Timestamp;
Modules§
- connection
- This offers an async interface for connecting to a DDP endpoint and exchange messages.
- protocol
- This contains the message types defined in the DDP spec
This module contains the
serde
datastructures for DDP