wamp_async 0.1.0

An asynchronous WAMP implementation
Documentation

wamp_async

crates.io mio Lines of Code

An asynchronous WAMP client implementation written in rust.

Usage

For usage examples, see :

// Publish event with no arguments and with acknowledgment
let ack_id = client.publish("peer.heartbeat", None, None, true).await?;
println!("Ack id {}", ack_id.unwrap());
// Register for events
let (_sub_id, mut event_queue) = client.subscribe("peer.heartbeat").await?;
// Wait for the next event
match event_queue.recv().await {
    Some((_pub_id, args, kwargs)) => println!("Event(args: {:?}, kwargs: {:?})", args, kwargs),
    None => println!("Event queue closed"),
};
// Call endpoint with one argument
let (args, kwargs) = client.call("peer.echo", Some(vec![Arg::Integer(12)]), None).await?;
println!("RPC returned {:?} {:?}", args, kwargs);
// Declare your RPC function
async fn rpc_echo(args: WampArgs, kwargs: WampKwArgs) -> Result<(WampArgs, WampKwArgs), WampError> {
    println!("peer.echo {:?} {:?}", args, kwargs);
    Ok((args, kwargs))
}

// Register the function
let rpc_id = client.register("peer.echo", rpc_echo).await?;

Features

Feature Desciption Status
Websocket Use websocket as the transport
Secure Websocket Websocket over HTTPS
RawSocket Use lightweight TCP as the transport
Secure RawSocket RawSocket with TLS
MsgPack Use MessagePack for message serialization
JSON Uses JSON for message serialization

Client

Basic profile :

Feature Desciption Status
Publisher Ability to publish messages on topics
Subscriber Can subscribe and receive events for a topic
Caller Ability to call RPC endpoints
Callee Ability to register RPC endpoints

Advanced profile:

TODO

License

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.