lerouxrgd / datachannel-rs

Rust wrappers for libdatachannel
Mozilla Public License 2.0
135 stars 26 forks source link

Simple example #16

Closed billyb2 closed 3 years ago

billyb2 commented 3 years ago

Hi, I've been messing with the examples given in the tests directory, and so far I'm trying to read through them to understand them. However, I'm very new to using WebRTC (used a JavaScript library before, but that's about it), and I'm having some issues with getting a simple example going. I'm trying to set up a peer on one computer, setup another peer on a seperate one, and they send each other a single message then print out the message given. I'm also trying to do this with the least amount of code possible, in order to be able to fully understand each basic part. I know it's a lot to ask, but it would really help me to understand the library more. Thanks a lot!

lerouxrgd commented 3 years ago

Hi, honestly local.rs is the simplest standalone example I could come up with. So let me know if you have more precise questions about it because it is the best to start.

The other one, websocket.rs is more realistic (and complicated) because in a use case such as the one you describe you will need a relay for the peers to exchange their SDP information (in order to create a datachannel that is fully peer to peer) and that is usually done with websockets trough a signaling server (a server that holds a HashMap of peer_id -> websocket).

I think you can also have a look at the examples in libdatachannel.

billyb2 commented 3 years ago

Alright, thabk you!