Skip to content

Commit d7064af

Browse files
authored
Rework data-channels-flow-control example (#307)
1 parent a000977 commit d7064af

File tree

2 files changed

+198
-304
lines changed

2 files changed

+198
-304
lines changed

examples/examples/data-channels-flow-control/README.md

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ The rate you wish to send data might be much higher than the rate the data chann
2222
actually send to the peer over the Internet. The above properties/methods help your
2323
application to pace the amount of data to be pushed into the data channel.
2424

25-
2625
## How to run the example code
27-
28-
The demo code implements two endpoints (offer_pc and answer_pc) in it.
26+
The demo code implements two endpoints (requester and responder) in it.
2927

3028
```
3129
signaling messages
@@ -34,31 +32,31 @@ The demo code implements two endpoints (offer_pc and answer_pc) in it.
3432
v v
3533
+---------------+ +---------------+
3634
| | data | |
37-
| offer_pc |----------------------->| answer_pc |
35+
| requester |----------------------->| responder |
3836
|:PeerConnection| |:PeerConnection|
3937
+---------------+ +---------------+
4038
```
4139

42-
First offer_pc and answer_pc will exchange signaling message to establish a peer-to-peer
40+
First requester and responder will exchange signaling message to establish a peer-to-peer
4341
connection, and data channel (label: "data").
4442

45-
Once the data channel is successfully opened, offer_pc will start sending a series of
46-
1024-byte packets to answer_pc as fast as it can, until you kill the process by Ctrl-c.
43+
Once the data channel is successfully opened, requester will start sending a series of
44+
1024-byte packets to responder, until you kill the process by Ctrl.
4745

46+
Here's how to run the code:
4847

49-
Here's how to run the code.
50-
51-
At the root of the example:
5248
```
53-
$ cargo run
54-
Peer Connection State has changed: connected (offerer)
55-
Peer Connection State has changed: connected (answerer)
56-
OnOpen: data-1. Start sending a series of 1024-byte packets as fast as it can
57-
OnOpen: data-1. Start receiving data
58-
Throughput: 12.990 Mbps
59-
Throughput: 13.698 Mbps
60-
Throughput: 13.559 Mbps
61-
Throughput: 13.345 Mbps
62-
Throughput: 13.565 Mbps
63-
:
49+
$ cargo run --release --example data-channels-flow-control
50+
Finished release [optimized] target(s) in 0.36s
51+
Running `target\release\examples\data-channels-flow-control.exe`
52+
53+
Throughput is about 127.060 Mbps
54+
Throughput is about 122.091 Mbps
55+
Throughput is about 120.630 Mbps
56+
Throughput is about 120.105 Mbps
57+
Throughput is about 119.873 Mbps
58+
Throughput is about 118.890 Mbps
59+
Throughput is about 118.525 Mbps
60+
Throughput is about 118.614 Mbps
61+
6462
```

0 commit comments

Comments
 (0)