3 releases

0.1.2 Apr 23, 2021
0.1.1 Apr 19, 2021
0.1.0 Apr 16, 2021

#19 in #connecting

MIT/Apache

20KB
396 lines

siderite

Rust client library for Meteor DDP.

Currently extremely limited (no actual object synchronisation), but useable for connecting, making RPC calls and receiving subscription messages by hand.


lib.rs:

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{..} => { ... }
   }
}

Dependencies

~15–27MB
~479K SLoC