<snapdata remixID="11461002"><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,iVBORw0KGgoAAAANSUhEUgAAAKAAAAB4CAYAAAB1ovlvAAAAAXNSR0IArs4c6QAADGNJREFUeF7tmntQFdcdx7+7e7lcQFBE8An4fkTHJ0gwcRIbUKtJO22qSdQ4Yx2TVItNnaYZ02Ra086kjrbNdNKZxqptNY2N7aSdxiYmIk4ilpioiUHRKOCDh+JFUJ6Xe+/e7ZwfhYKAa5GFMz2/8w/c5ew5v9/3+9mz5/wummVZFrixAn2kgMYA9pHyPC0pwAAyCH2qQKcAnjhxAsnJyTAMo0+D48l7VoGbN29C13UkJib27MB3MVoHAA8ePEjw9UW7mPMmGk/nALwt7Vn5NWD6t7LQNHQ66urqEBERgQkTJvTsHN0crR2AR48eRXR0dLeGun79Oq5evYrJkyd3uP/ixYsYOXJkp+OKOdPS0qBrGopefgAPffXr0BPGwn/oNx36G6PSYF442nrdGH0vzOKPcet1uwS66m8kzQR0A6GKc7Aab7abR3wwkmfBvHisXQziuj70HoSuFNhN262/a7EjoMePhlVdipC3+L8xjUylOPWhk5o1+I8WbSdxTX0YwS/20SV3xvdROHwB/X758mUsXLiwW/H09E3tACwtLYXX66U5jh8/jrNnzyIlJYV+9/l8qK2tRVxcHPWZP38+Tp48iYkTJ2LgwIHYtWsX0tPTERsbi3PnztG1a9euYdWqVcjNzUVVVRXEK2Dw4MFwuVw0VkZGBjZu3IidO3fSk1nySgYyv70R5rkPYYx/ADD90JNT4P9gK9wZz8Ly1cCqrwaa6mHVXoNr+tfQ+Ppj9DctOgEImbD8DfC/9woinnqL7jcvfgpoBvQRUxEq/QL6kAmwbpTB8tXRtcBH2+B+8Dtoeu8VhKUshZYwFvDVwSz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a8Q9HFSAAXRQXB7aXgEG0F4j7uGgAgygg+Ly0PYKMID2GnEPBxVgAB0Ul4e2V4ABtNeIezioAAPooLg8tL0CDKC9RtzDQQUYQAfF5aHtFWAA7TXiHg4qwAA6KC4Pba8AA2ivEfdwUAEG0EFxeWh7BRhAe424h4MK/Bt5fSgC5c8SVAAAAABJRU5ErkJggg==</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 x="0" y="0" 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 x="0" y="0" 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 x="0" y="0" 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;console.log(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+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+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" y="52"><custom-block s="Start collaboration"><comment w="205" collapsed="true">One partner starts by clicking this.</comment></custom-block></script><script x="76" y="113"><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>