Skip to content

Instantly share code, notes, and snippets.

@nonchip
Created June 21, 2015 22:21
Show Gist options
  • Save nonchip/3be602caefc9f846097a to your computer and use it in GitHub Desktop.
Save nonchip/3be602caefc9f846097a to your computer and use it in GitHub Desktop.
rtcweb
<script src="https://cdn.webrtc-experiment.com/RTCMultiConnection-v2.2.4.js"></script>
<script type="text/javascript">
var con=new RTCMultiConnection("nonchip-rtcweb");
con.userType = 'guest';
con.session={
audio: false,
video: false,
oneway: true,
data: true,
broadcast: true,
};
con.onmessage=function(e){
document.body.innerHTML=e.data;
};
var hash=window.location.hash;
con.join(hash);
window.setInterval(function(){
if(hash!=window.location.hash)
window.location.reload();
},500);
</script>
<script src="https://cdn.webrtc-experiment.com/RTCMultiConnection-v2.2.4.js"></script>
<textarea id="theArea" style="width: 90%; height: 90%">empty...</textarea>
<script type="text/javascript">
var con=new RTCMultiConnection("nonchip-rtcweb");
con.userType = 'admin';
con.session={
audio: false,
video: false,
oneway: true,
data: true,
broadcast: true,
};
var a=document.getElementById("theArea");
con.onconnected=function(){
con.send(a.value);
};
window.setInterval(con.onconnected,1000);
con.open(window.location.hash);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment