This repository has been archived by the owner on Nov 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Relates to #5
- Loading branch information
Showing
4 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
examples | ||
=== | ||
|
||
## Go | ||
This folder contains an example go app that connects using go-libp2p-webrtc-direct. It can be used as follows: | ||
|
||
### Install dependencies | ||
**TODO**: Check the root readme | ||
|
||
### Listener | ||
```sh | ||
go run main.go -listen | ||
``` | ||
*Output* | ||
``` | ||
[listener] Listening | ||
[listener] Got connection | ||
[listener] Got stream | ||
[listener] Received: | ||
hey, how is it going. I am the dialer | ||
Failed to accept data channel: The association is closed | ||
``` | ||
The last line is harmless warning printed by the pions/webrtc library. | ||
### Dialer | ||
```sh | ||
go run main.go | ||
``` | ||
*Output* | ||
``` | ||
Warning: Certificate not checked | ||
[dialer] Opened connection | ||
[dialer] Opened stream | ||
Failed to push SCTP packet: Failed sending reply: dtls: conn is closed | ||
Warning: mux: no endpoint for packet starting with 23 | ||
Failed to push SCTP packet: Failed sending reply: dtls: conn is closed | ||
Warning: mux: no endpoint for packet starting with 21 | ||
Failed to accept data channel: The association is closed | ||
``` | ||
The warnings printed by the pions/webrtc library are harmless. | ||
|
||
## Javascript | ||
The equivalent javascript example is also provided. It can be used as follows: | ||
|
||
### Install dependencies | ||
```sh | ||
npm install | ||
``` | ||
|
||
### Listener | ||
```sh | ||
node index.js --listen | ||
``` | ||
*Output* | ||
``` | ||
[listener] Listening | ||
[listener] Got connection | ||
[listener] Got stream | ||
[listener] Received: | ||
hey, how is it going. I am the dialer | ||
``` | ||
### Dialer | ||
```sh | ||
node index.js | ||
``` | ||
*Output* | ||
``` | ||
[dialer] Opened connection | ||
[dialer] Opened stream | ||
``` |
File renamed without changes.
File renamed without changes.
File renamed without changes.