Crate saltyrtc_client[−][src]
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.
This library requires Rust 1.26.
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
crypto |
Cryptography-related types like public/private keys. |
dep |
Re-exports of dependencies that are in the public API. |
errors |
Error types used in saltyrtc-client. |
tasks |
Task related types. |
Structs
PeerSequenceNumbers |
A snapshot of the incoming and outgoing sequence numbers between the SaltyRTC client and the peer. |
SaltyClient |
The SaltyRTC Client instance. |
SaltyClientBuilder |
The builder instance returned by
|
UnboundedChannel |
An unbounded channel sender/receiver pair. |
Enums
CloseCode |
Close codes used by SaltyRTC. |
Event |
Non-message events that may happen during connection. |
Role |
The role of a peer. |
Functions
connect |
Connect to the specified SaltyRTC server. |
do_handshake |
Do the server and peer handshake. |
task_loop |
Start the task loop. |
Type Definitions
BoxedFuture |
A type alias for a boxed future. |
WsClient |
A type alias for the async websocket client type. |