Skip to content

Instantly share code, notes, and snippets.

@fernandoc1
Created April 16, 2020 13:27
Show Gist options
  • Select an option

  • Save fernandoc1/fecd2656124628f7f5849042a5148fbe to your computer and use it in GitHub Desktop.

Select an option

Save fernandoc1/fecd2656124628f7f5849042a5148fbe to your computer and use it in GitHub Desktop.
<html>
<body>
</body>
</html>
<!-- Reference: https://github.com/brkho/client-server-webrtc-example/blob/master/client/example-client.js -->
<!-- stund -v -h 192.168.18.3 -a 127.0.0.1 -->
<script>
var config = {iceServers: [{ url: 'stun:localhost:3478'}]};
rtcPeerConnection = new RTCPeerConnection(config);
var dataChannelConfig = {ordered: true, maxRetransmits: 10};
dataChannel = rtcPeerConnection.createDataChannel('dc', dataChannelConfig);
rtcPeerConnection.createOffer(function (description)
{
console.log("DESCRIPTION:", description);
}).then(function (offer)
{
console.log("OFFER:", offer);
return rtcPeerConnection.setLocalDescription(offer);
}).catch(function(reason)
{
console.log("REASON:", reason);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment