Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
holochain_websocket
Holochain utilities for websocket serving and connecting.
To establish an outgoing connection, use [connect
]
which will return a tuple
([WebsocketSender
], [WebsocketReceiver
])
To open a listening socket, use [WebsocketListener::bind
]
which will give you a [WebsocketListener
]
which is an async Stream whose items resolve to that same tuple (
WebsocketSender,
WebsocketReceiver
).
If you want to be able to shutdown the stream use [WebsocketListener::bind_with_handle
]
which will give you a tuple ([ListenerHandle
], [ListenerStream
]).
You can use [ListenerHandle::close
] to close immediately or
[ListenerHandle::close_on
] to close on a future completing.
Example
use *;
use *;
use TryInto;
use StreamExt;
use *;
;
// Create a new server listening for connections
let mut server = bind
.await
.unwrap;
// Get the address of the server
let binding = server.local_addr.clone;
spawn;
// Connect the client to the server
let = connect
.await
.unwrap;
let msg = TestMessage;
// Make a request and get the echoed response
let rsp: TestMessage = send.request.await.unwrap;
assert_eq!;
Contribute
Holochain is an open source project. We welcome all sorts of participation and are actively working on increasing surface area to accept it. Please see our contributing guidelines for our general practices and protocols on participating in the community, as well as specific expectations around things like code formatting, testing practices, continuous integration, etc.
- Connect with us on our forum
License
Copyright (C) 2019 - 2024, Holochain Foundation
License: Apache-2.0