Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <body>
- <script>
- channel = new goog.appengine.Channel('{{ token }}');
- socket = channel.open();
- socket.onopen = onOpened;
- socket.onmessage = onMessage;
- socket.onerror = onError;
- socket.onclose = onClose;
- function onMessage (signal) {
- console.log('On message ' + signal)
- var msg = JSON.parse(signal.data);
- if (msg.type == "offer") {
- pc.setRemoteDescription(new RTCSessionDescription(msg.data));
- pc.createAnswer(gotAnswer);
- } else if (msg.type == "answer") {
- pc.setRemoteDescription(new RTCSessionDescription(msg.data));
- } else if(msg.type == "candidate") { // Candidate
- pc.addIceCandidate(new RTCIceCandidate(msg.data));
- }
- };
- </script>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement