mirror of
https://github.com/pion/webrtc.git
synced 2025-10-05 15:16:52 +08:00

Add OnICECandidate and OnICEGatheringStateChange methods to PeerConnection. The main goal of this change is to improve API compatibility with the JavaScript/Wasm bindings. It does not actually add trickle ICE support or change the ICE candidate gathering process, which is still synchronous in the Go implementation. Rather, it fires the appropriate events similar to they way they would be fired in a true trickle ICE process. Remove unused OnNegotiationNeeded event handler. This handler is not required for most applications and would be difficult to implement in Go. This commit removes the handler from the JavaScript/Wasm bindings, which leads to a more similar API for Go and JavaScript/Wasm. Add OnICEGatheringStateChange to the JavaScript/Wasm bindings. Also changes the Go implementation so that the function signatures match.
data-channels
data-channels is a pion-WebRTC application that shows how you can send/recv DataChannel messages from a web browser
Instructions
Download data-channels
go get github.com/pions/webrtc/examples/data-channels
Open data-channels example page
Run data-channels, with your browsers SessionDescription as stdin
In the jsfiddle the top textarea is your browser's session description, copy that and:
Linux/macOS
Run echo $BROWSER_SDP | data-channels
Windows
- Paste the SessionDescription into a file.
- Run
data-channels < my_file
Input data-channels's SessionDescription into your browser
Copy the text that data-channels
just emitted and copy into second text area
Hit 'Start Session' in jsfiddle
Under Start Session you should see 'Checking' as it starts connecting. If everything worked you should see New DataChannel foo 1
Now you can put whatever you want in the Message
textarea, and when you hit Send Message
it should appear in your browser!
You can also type in your terminal, and when you hit enter it will appear in your web browser.
Congrats, you have used pion-WebRTC! Now start building something cool