ockam_transport_websocket
Ockam is a library for building devices that communicate securely, privately and trustfully with cloud services and other devices.
This crate provides a WebSocket Transport for Ockam's Routing Protocol.
The Routing Protocol decouples Ockam's suite of cryptographic protocols, like secure channels, key lifecycle, credential exchange, enrollment etc. from the underlying transport protocols. This allows applications to establish end-to-end trust between entities.
WebSocket is one possible transport for Routing Protocol messages, over time there will be more transport implementations.
Usage
Add this to your Cargo.toml
:
[dependencies]
ockam_transport_websocket = "0.69.0"
This crate requires the rust standard library "std"
.
We need to define the behavior of the worker that will be processing incoming messages.
;
Now we can write the main function that will run the previous worker. In this case, our worker will be listening for new connections on port 8000 until the process is manually killed.
use WebSocketTransport;
use ;
async
Finally, we can write another node that connects to the node that is hosting the MyWorker
worker, and we are ready to send and receive messages between them.
use ;
use ;
async
License
This code is licensed under the terms of the Apache License 2.0.