mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-04-26 19:22:21 +00:00
This PR implements `Transport` for WebRTC for browsers by using web-sys. Only the `webrtc-direct` spec is implemented. The `webrtc` spec for connecting two browsers with each other is left to a future PR. Related: https://github.com/libp2p/specs/issues/475. Related #2617. Supersedes: #4229. Pull-Request: #4248. Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
19 lines
475 B
Markdown
19 lines
475 B
Markdown
# Rust-libp2p Browser-Server WebRTC Example
|
|
|
|
This example demonstrates how to use the `libp2p-webrtc-websys` transport library in a browser to ping the WebRTC Server.
|
|
It uses [wasm-pack](https://rustwasm.github.io/docs/wasm-pack/) to build the project for use in the browser.
|
|
|
|
## Running the example
|
|
|
|
1. Build the client library:
|
|
```shell
|
|
wasm-pack build --target web --out-dir static
|
|
```
|
|
|
|
2. Start the server:
|
|
```shell
|
|
cargo run
|
|
```
|
|
|
|
3. Open the URL printed in the terminal
|