Crate saltyrtc_client
source · [−]Expand description
SaltyRTC client implementation in Rust.
SaltyRTC is an end-to-end encrypted signalling protocol. It offers to freely choose from a range of signalling tasks, such as setting up a WebRTC or ORTC peer-to-peer connection, or using the WebSocket based signaling server as a relay. SaltyRTC is completely open to new and custom signalling tasks for everything feasible.
The implementation is asynchronous using Tokio / Futures.
Usage
To establish a SaltyRTC connection:
- Create an instance of a type that implements the
Task
interface. - Using that task instance, create a
SaltyClient
instance using theSaltyClientBuilder
. - Create an instance of the Tokio reactor core.
- Create a connect future and an event channel using the
connect
function. - Pass the result of the connect future to the
do_handshake
function. - Pass the result of the handshake future (the WebSocket client) to the
task_loop
function. - Send and receive data through the event channel returned by the
connect
function. Send and receive data through the task instance.
For a real-life example, please take a look at the chat example.
Timeouts
If you want timeouts (e.g. for connecting, for the handshake, etc) combine the futures with a timeout feature (for example from tokio-timer).
Modules
Cryptography-related types like public/private keys.
Re-exports of dependencies that are in the public API.
Error types used in saltyrtc-client.
Task related types.
Structs
A snapshot of the incoming and outgoing sequence numbers between the
SaltyRTC client and the peer.
The SaltyRTC Client instance.
The builder instance returned by
SaltyClient::build
. Use this
builder to construct a SaltyClient
instance.An unbounded channel sender/receiver pair.
Enums
Close codes used by SaltyRTC.
Non-message events that may happen during connection.
The role of a peer.
Functions
Connect to the specified SaltyRTC server.
Do the server and peer handshake.
Start the task loop.
Type Definitions
A type alias for a boxed future.
A type alias for the async websocket client type.