<snapdata remixID="9015967"><project name="webrtc" app="Snap! 7, https://snap.berkeley.edu" version="2"><notes>This uses the WebRTC standard to create a connection between two browsers. It relies only upon peer-to-peer communication.&#xD;&#xD;Visit https://webrtc.org/ for more information.&#xD;&#xD;Please report questions or problems to Ken Kahn &lt;toontalk@gmail.com&gt;</notes><thumbnail>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAB4CAYAAAB1ovlvAAAAAXNSR0IArs4c6QAACnVJREFUeF7tmn9MVNkVx88IDIpY1tSI1ob4Y7OaVUshraHVuP5o+odRYmSzuzZaY7QbazbZSquuG6vR9UfdxLpNzNa0RZNqt64lxiiJpqkGLamIrhRsqoKAsHFdKGJEFmGGYZpzmPv2Db/eTXbOIvB9iXFm3nnn3vu5n3ff3DP4wuFwmHCAwAAR8EHAASKPZoUABIQIA0qgTwFv3LhBxcXFFAwGB7SDaHxoE+gh4LNnz6i2tpYSEhKe+5FzH/92+D2q+E8ZhQlfZZ/7Ceulgz0EvHPnzqAZR3Pj5/TyuZ8Omv6ioz0JRAlYWFhI48aNiymn0tJSysjIIPN/X8lnz55Nt27d8mx7w4YNdOTIEYmru1NO86+/Q/4f/5L8i9+mlq1p/V4fN+2HFKr6V4+Y5N3/pZYdL1N85go513HztGc/+gtIfPV9as/f0mfI6K3/pGDpGQpVXe29PwfqZCzJB+ooeP2k5OK+fdV+faVB9XMxj6ez6VN69sef9Bo1+t0S+mLfHDnnfs2cogTcvXs3LVu2LCpJZmamvD99+jStWLGC1q9fT5WVlXT58mW6dOkSLVq0SM5XV1fT1KlT5bX5fMeOHcQ5GxoaqKKigubNmyfnb968SSYvv+bDvL9//z5NnjyZjh07RmvXrqWjR4/SmjVrqKysjE6dOiUi79+/X675rOo2vXL9HUrK/Qe1/vZHXSLOW0eUmOyM4dkf3qBRb54kam+Rz0P3iijuxa5+8OQmfP8NOWcEHPn6B13XRj4zMrGkJi/n9KVMIBNrZOHL+DVfI3kj71mkcOtj+mJXOvFNwP0JXPyd3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TgrQIQEAtsshrRQACWmFCkBYBCKhFFnmtCEBAK0wI0iIAAbXIIq8VAQhohQlBWgQgoBZZ5LUiAAGtMCFIiwAE7IdsTk4ONTU10ZatufTd9O/RxIkTteZh2OaFgB5Tn52dTXFxcU7UkyeP6aO//oUmpE4attLEcuAQ0IPmgwd19NZbb/eICofD5Pf76enTp3T+/PlYzsmwygUBPaZ72bKlFB+fEBVVV1dHe/fupYULF1JiYuKwEibWg4WA/RDdsuVXVFlZRcFgkLKysig3N5eSkpJiPQfDOh8E7Gf6m5ubacyYMeTz+Ya1JJqDh4CadJHbkwAE9ESEAE0CEFCTLnJ7EoCAnogQoEkAAmrSRW5PAhDQExECNAlAQE26yO1JAAJ6IkKAJgEIqEkXuT0JQEBPRAjQJAABNekitycBCOiJCAGaBCCgJl3k9iQAAT0RIUCTAATUpIvcngQgoCciBGgSgICadJHbkwAE9ESEAE0CEFCTLnJ7EoCAnogQoEkAAmrSRW5PAhDQExECNAlAQE26yO1JAAJ6IkKAJgEIqEkXuT0JQEBPRAjQJPB/1Y/JEM4F8V4AAAAASUVORK5CYII=</thumbnail><scenes select="1"><scene name="webrtc"><notes>This uses the WebRTC standard to create a connection between two browsers. It relies only upon peer-to-peer communication.&#xD;&#xD;Visit https://webrtc.org/ for more information.&#xD;&#xD;Please report questions or problems to Ken Kahn &lt;toontalk@gmail.com&gt;</notes><hidden></hidden><headers></headers><code></code><blocks><block-definition s="Load Web Real-Time Communication then %&apos;then do&apos;" type="command" category="other"><header></header><code></code><translations></translations><inputs><input type="%cs"></input></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l>callback</l></list><l>if (typeof webrtc === &apos;undefined&apos;) {&#xD;     if (typeof ecraft2learn === &apos;undefined&apos;) {&#xD;         window.invoke_callback = (snap_callback, ...args) =&gt; {&#xD;             if (typeof callback === &apos;function&apos;) { &#xD;                 callback.apply(this, args);&#xD;                 return;&#xD;             }&#xD;             if (!(callback.expression instanceof CommandBlockMorph ||&#xD;                   callback.expression instanceof ReporterBlockMorph)) {&#xD;                 return;&#xD;             }&#xD;             const stage = world.children[0].stage; // this.parentThatIsA(StageMorph);&#xD;             const process = new Process(null, snap_callback.receiver, null, true);&#xD;             process.initializeFor(snap_callback, new List(args));&#xD;             stage.threads.processes.push(process);&#xD;         };&#xD;     } else {&#xD;         window.invoke_callback = ecraft2learn.invoke_callback;&#xD;     }&#xD;     window.javascript_to_snap = (x) =&gt; {&#xD;         if (x instanceof Array) {&#xD;             return new List(x.map((element) =&gt; javascript_to_snap(element)));&#xD;         } else if (x instanceof Object) {&#xD;             return new List(Object.keys(x).map((key) =&gt; &#xD;                                                new List(key,javascript_to_snap(x[key]))));&#xD;         } else {&#xD;             return x;&#xD;         }&#xD;     };         &#xD;     const script = document.createElement(&apos;script&apos;);&#xD;     script.onload = (event) =&gt; {&#xD;         webrtc.set_process_parsed_message(javascript_to_snap);&#xD;         invoke_callback(callback);&#xD;     };&#xD;     if (window.location.hostname === "localhost") {&#xD;         script.src = "/ai/js/webrtc.js";&#xD;     } else {&#xD;         script.src = "https://ecraft2learn.github.io/ai/js/webrtc.js";&#xD;     } &#xD;     document.body.appendChild(script);&#xD;} else {&#xD;    invoke_callback(callback)&#xD;}&#xD;</l></block><list><block var="then do"/></list></block></script></block-definition><block-definition s="Start a new connection then %&apos;get connection key&apos; $nl but if error %&apos;handle error&apos;" type="command" category="other"><comment w="271" collapsed="false">&apos;get connection key&apos; will be run with a connection key that needs to be sent to the partner who should run &apos;Accept this communication offer.</comment><header></header><code></code><translations></translations><inputs><input type="%cmdRing"></input><input type="%cmdRing"></input></inputs><script><custom-block s="Load Web Real-Time Communication then %cs"><script><block s="doRun"><block s="reportJSFunction"><list><l>success</l><l>error</l></list><l>webrtc.create_connection_offer(success, error);</l></block><list><block var="get connection key"/><block var="handle error"/></list></block></script></custom-block></script></block-definition><block-definition s="Accept this connection offer: %&apos;connection key&apos; then %&apos;get response key&apos; $nl but if error %&apos;handle error&apos;" type="command" category="other"><comment x="0" y="0" w="250.00000099999988" collapsed="false">After receiving a key from a partner that ran &apos;Start a new connection&apos; paste it here. Then send the partner the key passed to &apos;get response key&apos;..</comment><header></header><code></code><translations></translations><inputs><input type="%txt"></input><input type="%cmdRing"></input><input type="%cmdRing"></input></inputs><script><custom-block s="Load Web Real-Time Communication then %cs"><script><block s="doRun"><block s="reportJSFunction"><list><l>connection_key</l><l>success</l><l>error</l></list><l>webrtc.accept_connection_offer(connection_key, success, error);</l></block><list><block var="connection key"/><block var="get response key"/><block var="handle error"/></list></block></script></custom-block></script></block-definition><block-definition s="Accept this answer: %&apos;connection answer key&apos; to my connection offer then %&apos;then do&apos; but if error %&apos;handle error&apos;" type="command" category="other"><comment w="264" collapsed="false">After receiving a key from the partner you sent an invitation key paste it as the &apos;connection answer key&apos; and you should be connected.</comment><header></header><code></code><translations></translations><inputs><input type="%txt"></input><input type="%cs"></input><input type="%cmdRing"></input></inputs><script><custom-block s="Load Web Real-Time Communication then %cs"><script><block s="doRun"><block s="reportJSFunction"><list><l>connection_key</l><l>success</l><l>error</l></list><l>webrtc.accept_answer(connection_key, success, error);</l></block><list><block var="connection answer key"/><block var="then do"/><block var="handle error"/></list></block></script></custom-block></script></block-definition><block-definition s="Send message %&apos;message&apos; $nl but if error %&apos;handle error&apos;" type="command" category="other"><comment x="0" y="0" w="193.00000099999986" collapsed="false">After a connection has been made you can send data to your partner..</comment><header></header><code></code><translations></translations><inputs><input type="%s"></input><input type="%cmdRing"></input></inputs><script><custom-block s="Load Web Real-Time Communication then %cs"><script><block s="doRun"><block s="reportJSFunction"><list><l>message</l><l>error</l></list><l>webrtc.send_data(typeof message === &apos;string&apos; ? message : message.asJSON(), error);</l></block><list><block var="message"/><block var="handle error"/></list></block></script></custom-block></script></block-definition><block-definition s="When I receive a message %&apos;get message&apos;" type="command" category="other"><comment x="0" y="0" w="259" collapsed="false">The &apos;get message&apos; command will receive every message received from your partner..</comment><header></header><code></code><translations></translations><inputs><input type="%cmdRing"></input></inputs><script><custom-block s="Load Web Real-Time Communication then %cs"><script><block s="doRun"><block s="reportJSFunction"><list><l>message_handler</l></list><l>webrtc.on_message(message_handler);</l></block><list><block var="get message"/></list></block></script></custom-block></script></block-definition><block-definition s="Start collaboration" type="command" category="other"><comment w="221.99999999999997" collapsed="false">Creates an invitation to collaborate that you need to send to your partner to communicate.</comment><header></header><code></code><translations></translations><inputs></inputs><script><block s="doSayFor"><l>Creating a connection key. This can take several seconds.</l><l>5</l></block><custom-block s="Start a new connection then %cmdRing %br but if error %cmdRing"><block s="reifyScript"><script><block s="doSetVar"><l>connection key 1</l><l></l></block><block s="doAsk"><l>Export your &apos;connection key 1&apos; and send it to your partner. When you get a response paste it here:</l></block><custom-block s="Accept this answer: %txt to my connection offer then %cs but if error %cmdRing"><block s="getLastAnswer"></block><script><block s="bubble"><l>Communication established. Ready to send messages.</l></block><custom-block s="When I receive a message %cmdRing"><block s="reifyScript"><script><block s="bubble"><l></l></block></script><list></list></block></custom-block><custom-block s="Send message %s %br but if error %cmdRing"><l>We are connected now!</l><block s="reifyScript"><script><block s="doThink"><l></l></block></script><list></list></block></custom-block></script><block s="reifyScript"><script><block s="doThink"><l></l></block></script><list></list></block></custom-block></script><list></list></block><block s="reifyScript"><script><block s="doThink"><l></l></block></script><list></list></block></custom-block></script></block-definition><block-definition s="Accept collaboration" type="command" category="other"><comment x="0" y="0" w="548" collapsed="false">After your partner has sent you a connection offer paste it here and then send back the response.</comment><header></header><code></code><translations></translations><inputs></inputs><script><block s="doAsk"><l>When your partner sends you a key, copy and paste it here:</l></block><block s="doSayFor"><l>Creating a connection key. This can take several seconds.</l><l>5</l></block><custom-block s="Accept this connection offer: %txt then %cmdRing %br but if error %cmdRing"><block s="getLastAnswer"></block><block s="reifyScript"><script><block s="doSetVar"><l>connection key 2</l><l></l></block><block s="bubble"><l>And now export &apos;connection key 2&apos; and send it to your partner.</l></block><custom-block s="When I receive a message %cmdRing"><block s="reifyScript"><script><block s="bubble"><l></l></block></script><list></list></block></custom-block></script><list></list></block><block s="reifyScript"><script><block s="doThink"><l></l></block></script><list></list></block></custom-block></script></block-definition><block-definition s="Javascript to Snap! %&apos;JavaScript object&apos;" type="reporter" category="other"><header></header><code></code><translations></translations><inputs><input type="%s"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>javascript_object</l></list><l>return javascript_to_snap(javascript_object);&#xD;&#xD;function javascript_to_snap(x) {&#xD;    if (x instanceof Array) {&#xD;        return new List(x.map((element) =&gt; javascript_to_snap(element)));&#xD;    } else if (x instanceof Object) {&#xD;        return new List(Object.keys(x).map((key) =&gt; &#xD;                                                new List(key,javascript_to_snap(x[key])])));&#xD;    } else {&#xD;        return x;&#xD;     }&#xD; };</l></block><list><block var="JavaScript object"/></list></block></block></script></block-definition><block-definition s="Close connection" type="command" category="other"><comment x="0" y="0" w="285.7142857142857" collapsed="false">Closes the connection to your collaborator..</comment><header></header><code></code><translations></translations><inputs></inputs><script><custom-block s="Load Web Real-Time Communication then %cs"><script><block s="doRun"><block s="reportJSFunction"><list></list><l>webrtc.close_connection();</l></block><list></list></block></script></custom-block></script></block-definition></blocks><stage name="Stage" width="480" height="360" costume="0" color="255,255,255,1" tempo="60" threadsafe="false" penlog="false" volume="100" pan="0" lines="round" ternary="false" hyperops="true" codify="false" inheritance="true" sublistIDs="false" id="228"><pentrails>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAeAAAAFoCAYAAACPNyggAAAAAXNSR0IArs4c6QAADoVJREFUeF7t1cEJAAAIxDDdf2m3sJ+4wEEQuuMIECBAgACBd4F9XzRIgAABAgQIjAB7AgIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQIC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IECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECAiwHyBAgAABAoGAAAfoJgkQIECAgAD7AQIECBAgEAgIcIBukgABAgQICLAfIECAAAECgYAAB+gmCRAgQICAAPsBAgQIECAQCAhwgG6SAAECBAgIsB8gQIAAAQKBgAAH6CYJECBAgIAA+wECBAgQIBAICHCAbpIAAQIECByxcQFpoRMBzwAAAABJRU5ErkJggg==</pentrails><costumes><list struct="atomic" id="229"></list></costumes><sounds><list struct="atomic" id="230"></list></sounds><variables></variables><blocks></blocks><scripts></scripts><sprites select="1"><sprite name="Advanced" idx="2" x="1" y="-91" heading="90" scale="1" volume="100" pan="0" rotation="1" draggable="true" costume="0" color="215.832,234.60000000000002,0,1" pen="tip" id="235"><costumes><list struct="atomic" id="236"></list></costumes><sounds><list struct="atomic" id="237"></list></sounds><blocks></blocks><variables></variables><scripts><script x="28.999999999999996" y="25"><custom-block s="Start a new connection then %cmdRing %br but if error %cmdRing"><block s="reifyScript"><script><block s="doSetVar"><l>connection key 1</l><l></l></block></script><list></list></block><block s="reifyScript"><script><block s="doThink"><l></l></block></script><list></list></block></custom-block></script><script x="32.00000000000001" y="125.99999999999999"><custom-block s="Accept this connection offer: %txt then %cmdRing %br but if error %cmdRing"><l></l><block s="reifyScript"><script><block s="doSetVar"><l>connection key 2</l><l></l></block></script><list></list></block><block s="reifyScript"><script><block s="doThink"><l></l></block></script><list></list></block></custom-block></script><script x="35" y="225.00000000000003"><custom-block s="Accept this answer: %txt to my connection offer then %cs but if error %cmdRing"><l>%7B%22type%22%3A%22answer%22%2C%22sdp%22%3A%22v%3D0%5Cr%5Cno%3D-%207999543097828504906%202%20IN%20IP4%20127.0.0.1%5Cr%5Cns%3D-%5Cr%5Cnt%3D0%200%5Cr%5Cna%3Dgroup%3ABUNDLE%200%5Cr%5Cna%3Dmsid-semantic%3A%20WMS%5Cr%5Cnm%3Dapplication%2055722%20UDP%2FDTLS%2FSCTP%20webrtc-datachannel%5Cr%5Cnc%3DIN%20IP4%202.25.204.160%5Cr%5Cnb%3DAS%3A30%5Cr%5Cna%3Dcandidate%3A2089671618%201%20udp%202113937151%203d5da0d5-4e8c-4c4b-8c12-7ac7d646b008.local%2055722%20typ%20host%20generation%200%20network-cost%20999%5Cr%5Cna%3Dcandidate%3A842163049%201%20udp%201677729535%202.25.204.160%2055722%20typ%20srflx%20raddr%200.0.0.0%20rport%200%20generation%200%20network-cost%20999%5Cr%5Cna%3Dice-ufrag%3Avpdb%5Cr%5Cna%3Dice-pwd%3AraH8xDmFOHLPmtZrhGDMDNjC%5Cr%5Cna%3Dice-options%3Atrickle%5Cr%5Cna%3Dfingerprint%3Asha-256%2022%3AA5%3A11%3A2B%3A74%3A8C%3A9A%3AD0%3ADF%3AAD%3A55%3A18%3A29%3A0F%3ACC%3A4C%3AB3%3A13%3ADA%3A72%3A6F%3AD6%3AC5%3AB0%3AAE%3A4F%3A59%3A1E%3AF7%3A54%3AD6%3AD1%5Cr%5Cna%3Dsetup%3Aactive%5Cr%5Cna%3Dmid%3A0%5Cr%5Cna%3Dsctp-port%3A5000%5Cr%5Cna%3Dmax-message-size%3A262144%5Cr%5Cn%22%7D</l><script><block s="bubble"><l>Communication established. Ready to send messages.</l></block></script><block s="reifyScript"><script><block s="doThink"><l></l></block></script><list></list></block></custom-block></script><script x="36.00000000000001" y="331.85714285714283"><custom-block s="When I receive a message %cmdRing"><block s="reifyScript"><script><block s="bubble"><l></l></block></script><list></list></block></custom-block></script><script x="37.28571428571428" y="457.14285714285717"><block s="receiveKey"><l><option>space</option></l><list></list><comment w="148" collapsed="false">Just a convenient way to reset the project before exporting it..</comment></block><block s="doSetVar"><l>connection key 1</l><l>Created by running the &apos;Start a new connection&apos; block</l></block><block s="doSetVar"><l>connection key 2</l><l>Created by running the &apos;Accept connection offer&apos; block</l></block></script><script x="37.85714285714286" y="398.5714285714286"><custom-block s="Close connection"><comment w="287.14285714285717" collapsed="true">Releases the resources used by the current connection.</comment></custom-block></script></scripts></sprite><sprite name="Sprite" idx="1" x="2" y="-92" heading="90" scale="1" volume="100" pan="0" rotation="1" draggable="true" costume="0" color="80,80,80,1" pen="tip" id="312"><costumes><list struct="atomic" id="313"></list></costumes><sounds><list struct="atomic" id="314"></list></sounds><blocks></blocks><variables></variables><scripts><script x="72.00000000000001" y="52.000000000000014"><custom-block s="Start collaboration"><comment w="205" collapsed="true">One partner starts by clicking this.</comment></custom-block></script><script x="75.99999999999999" y="112.99999999999996"><custom-block s="Accept collaboration"><comment w="309" collapsed="true">The other partner clicks this and waits for an invitation key.</comment></custom-block></script><script x="70" y="183.99999999999994"><custom-block s="Send message %s %br but if error %cmdRing"><block s="reportNewList"><list><l>a</l><l>b</l></list></block><block s="reifyScript"><script><block s="doThink"><l></l></block></script><list></list></block><comment w="236.99999999999997" collapsed="true">After connection is made try sending data.</comment></custom-block></script><script x="70" y="270"><custom-block s="When I receive a message %cmdRing"><block s="reifyScript"><script><block s="bubble"><l></l></block></script><list></list></block><comment w="262" collapsed="true">Here&apos;s what is done for each message received.</comment></custom-block></script></scripts></sprite><watcher var="connection key 1" style="normal" x="10" y="10" color="243,118,29"/><watcher var="connection key 2" style="normal" x="10" y="31.000001999999995" color="243,118,29"/></sprites></stage><variables><variable name="connection key 1"><l>Created by running the &apos;Start a new connection&apos; block</l></variable><variable name="connection key 2"><l>Created by running the &apos;Accept connection offer&apos; block</l></variable></variables></scene></scenes></project><media name="webrtc" app="Snap! 7, https://snap.berkeley.edu" version="2"></media></snapdata>