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.
This crate requires the rust standard library "std"
.
We need to define the behavior of the worker that will be processing incoming messages.
use ;
use Context;
;
// 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 NodeBuilder;
use node;
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 ;
use Context;
use node;
async
Usage
Add this to your Cargo.toml
:
[dependencies]
ockam_transport_websocket = "0.97.0"
License
This code is licensed under the terms of the Apache License 2.0.