Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Last active November 15, 2018 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenwebb/d6eada52b8a14384ebdec837f7356ba7 to your computer and use it in GitHub Desktop.
Save kenwebb/d6eada52b8a14384ebdec837f7356ba7 to your computer and use it in GitHub Desktop.
WebRTC complex Canada 2018
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Thu Nov 15 2018 08:08:19 GMT-0500 (Eastern Standard Time)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: WebRTC complex Canada 2018
Description:
Url: http://www.primordion.com/Xholon/gwt/
InternalName: d6eada52b8a14384ebdec837f7356ba7 based on 3872b340823c982c39fa73288a1d9d17
Keywords:
My Notes
--------
September 14, 2018
- set host and key in port connector to "delete"
Load this wb as:
http://127.0.0.1:8888/XholonWebRTC.html?app=WebRTC+complex+Canada+2018&src=lstr&gui=none
http://127.0.0.1:8888/XholonWebRTC.html?app=WebRTC+complex+Canada+2018&src=lstr&gui=none&localid0=Able101&localid1=Baker101&localid2=Charlie101
http://127.0.0.1:8888/XholonWebRTC.html?app=d6eada52b8a14384ebdec837f7356ba7&src=gist&gui=none&localid0=Able101&localid1=Baker101&localid2=Charlie101
Use this URL if running a local peerjs server:
http://127.0.0.1:8888/XholonWebRTC.html?app=WebRTC+complex+Canada+2018&src=lstr&gui=none&localid0=Able101&localid1=Baker101&localid2=Charlie101&ver=localhost
Use this URL if running my version of peerjs server on heroku localhost:
http://127.0.0.1:8888/XholonWebRTC.html?app=WebRTC+complex+Canada+2018&src=lstr&gui=none&localid0=Able101&localid1=Baker101&localid2=Charlie101&ver=herokulocalhost
Use this URL if running my version of peerjs server on herokuapp.com:
http://127.0.0.1:8888/XholonWebRTC.html?app=WebRTC+complex+Canada+2018&src=lstr&gui=none&localid0=Able101&localid1=Baker101&localid2=Charlie101&ver=herokuxhpeerjs
http://127.0.0.1:8888/XholonWebRTC.html?app=d6eada52b8a14384ebdec837f7356ba7&src=gist&gui=none&localid0=Able101&localid1=Baker101&localid2=Charlie101&ver=herokuxhpeerjs
http://www.primordion.com/Xholon/gwt/XholonWebRTC.html?app=d6eada52b8a14384ebdec837f7356ba7&src=gist&gui=none&localid0=Able101&localid1=Baker101&localid2=Charlie101&ver=herokuxhpeerjs
https://www.primordion.com/Xholon/gwt/XholonWebRTC.html?app=d6eada52b8a14384ebdec837f7356ba7&src=gist&gui=none&localid0=Able101&localid1=Baker101&localid2=Charlie101&ver=herokuxhpeerjs
Use the 10 provinces of Canada as node names.
Each node will have zero or more trop and/or port connections.
I will use this to test out various networks between nodes, where the nodes reside on one or more browser instances and computers.
This workbook is designed to work with the "WebRTC complex Schweiz 2018" workbook.
References
----------
() http://peerjs.com/
]]></Notes>
<_-.XholonClass>
<PhysicalSystem/>
<Universe/>
<!-- the 10 provinces of Canada -->
<BritishColumbia/>
<Alberta/>
<Saskatchewan/>
<Manitoba/>
<Ontario/>
<Quebec/>
<NewBrunswick/>
<NovaScotia/>
<PrinceEdwardIsland/>
<Newfoundland/>
<Gift/>
<container/>
<Ort/>
</_-.XholonClass>
<xholonClassDetails>
<?xmlreader-patch {
"localhost":
[
{"op":"replace", "sel":"./Ontario/port/@connector", "content":"RemoteNodeService-PeerJS,localid0,delete,3,localhost,9000,/"},
{"op":"replace", "sel":"./Ontario/port[2]/@connector", "content":"RemoteNodeService-PeerJS,localid1,delete,3,localhost,9000,/"},
{"op":"replace", "sel":"./Quebec/port/@connector", "content":"RemoteNodeService-PeerJS,localid2,delete,3,localhost,9000,/"}
]
,
"herokulocalhost":
[
{"op":"replace", "sel":"./Ontario/port/@connector", "content":"RemoteNodeService-PeerJS,localid0,delete,3,localhost,5000,/"},
{"op":"replace", "sel":"./Ontario/port[2]/@connector", "content":"RemoteNodeService-PeerJS,localid1,delete,3,localhost,5000,/"},
{"op":"replace", "sel":"./Quebec/port/@connector", "content":"RemoteNodeService-PeerJS,localid2,delete,3,localhost,5000,/"}
]
,
"herokuxhpeerjs":
[
{"op":"replace", "sel":"./Ontario/port/@connector", "content":"RemoteNodeService-PeerJS,localid0,delete,3,xhpserver.herokuapp.com,,/"},
{"op":"replace", "sel":"./Ontario/port[2]/@connector", "content":"RemoteNodeService-PeerJS,localid1,delete,3,xhpserver.herokuapp.com,,/"},
{"op":"replace", "sel":"./Quebec/port/@connector", "content":"RemoteNodeService-PeerJS,localid2,delete,3,xhpserver.herokuapp.com,,/"}
]
}
?>
<!-- var wsUri = "ws://stark-fortress-34121.herokuapp.com/peerjs?key=peerjs&id=WebRTC%20complex%20Sch_1542202922943_47&token=zpe65vkozo"; -->
<!-- THIS WORKS OLD
"herokuxhpeerjs":
[
{"op":"replace", "sel":"./Ontario/port/@connector", "content":"RemoteNodeService-PeerJS,localid0,delete,3,stark-fortress-34121.herokuapp.com,,/"},
{"op":"replace", "sel":"./Ontario/port[2]/@connector", "content":"RemoteNodeService-PeerJS,localid1,delete,3,stark-fortress-34121.herokuapp.com,,/"},
{"op":"replace", "sel":"./Quebec/port/@connector", "content":"RemoteNodeService-PeerJS,localid2,delete,3,stark-fortress-34121.herokuapp.com,,/"}
]
-->
<Ontario xhType="XhtypePureActiveObject">
<port name="trop" index="0" connector="RemoteNodeService-PeerJS,localid0,delete,3,delete,9000,/"/>
<port name="trop" index="1" connector="RemoteNodeService-PeerJS,localid1,delete,3,delete,9000,/"/>
</Ontario>
<Quebec xhType="XhtypePureActiveObject">
<port name="trop" index="0" connector="RemoteNodeService-PeerJS,localid2,delete,3,delete,9000,/"/>
</Quebec>
<!--<Manitoba xhType="XhtypePureActiveObject">
<port name="trop" index="0" connector="RemoteNodeService-PeerJS,GeorgeA,lwjd5qra8257b9,3,0.peerjs.com,9000,/"/>
</Manitoba>-->
<Avatar><Color>red</Color></Avatar>
<Gift><Color>indigo</Color></Gift>
<container><Color>orange</Color></container>
<Ort><Color>green</Color></Ort>
</xholonClassDetails>
<PhysicalSystem>
<Universe>
<Ontario/>
<Quebec/>
</Universe>
<Animate duration="1" selection="#one" xpath="./PhysicalSystem/Universe" efParams="{&quot;selection&quot;:&quot;#one&quot;,&quot;sort&quot;:&quot;disable&quot;,&quot;width&quot;:600,&quot;height&quot;:600,&quot;mode&quot;:&quot;tween&quot;,&quot;labelContainers&quot;:true,&quot;includeId&quot;:true,&quot;shape&quot;:&quot;circle&quot;,&quot;maxChars&quot;:4,&quot;togglePortColors&quot;:false}"/>
</PhysicalSystem>
<PhysicalSystembehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var me, beh = {
postConfigure: function() {
me = this.cnode.parent();
$wnd.xh.param("TimeStepInterval", 1000);
// SVG caption
$wnd.xh.svg = {};
$wnd.xh.svg.caption = $doc.createElement("p");
$wnd.xh.svg.caption.textContent = $wnd.xh.param("ModelName");
var div = $doc.querySelector("#xhanim");
// create a new div for this animation
var one = $doc.createElement("div");
one.setAttribute("id", "one");
div.appendChild(one);
one.appendChild($wnd.xh.svg.caption);
$wnd.xh.root().append(this.cnode.remove());
var ava = $wnd.xh.avatar();
ava.action("param setCtxtOnselect false;enter physicalSystem;enter universe;enter ontario;appear;start;");
if ($wnd.xh.html["selectTab"]) {
$wnd.xh.html.selectTab(0); // display contents of the "out" tab
}
}
}
//# sourceURL=PhysicalSystembehavior.js
]]></PhysicalSystembehavior>
<Ontariobehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var me, meName, beh = {
postConfigure: function() {
me = this.cnode.parent();
meName = me.xhc().name();
//THIS BEHAVIOR NODE MUST REMAIN A DIRECT CHILD OF THE Ontario NODE (otherwise the call to processReceivedMessage() won't work)
//root.append(this.cnode.remove());
},
act: function() {
// send one or more test messages from Ontario, through the proxy, to the remote end (these are asynchronous messages)
if (me.port(0)) {
me.port(0).msg(103, meName + " " + $wnd.xh.param("TimeStep"), this.cnode);
}
if (this.cnode.first()) {
// a user may accidentally drop some content onto the behavior (this.cnode) node instead of the me node
me.append(this.cnode.first().remove());
}
},
processReceivedMessage: function(msg) {
me.println("processReceivedMessage " + meName + " " + msg.data);
},
// receive messages from a remote source such as PeerjsChat.html
processReceivedSyncMessage: function(msg) {
me.println("processReceivedSyncMessage " + meName + " " + msg.data);
return msg.data.toUpperCase();
}
}
//# sourceURL=Ontariobehavior.js
]]></Ontariobehavior>
<Quebecbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var me, meName, beh = {
postConfigure: function() {
me = this.cnode.parent();
meName = me.xhc().name();
//THIS BEHAVIOR NODE MUST REMAIN A DIRECT CHILD OF THE Quebec NODE (otherwise the call to processReceivedMessage() won't work)
//root.append(this.cnode.remove());
},
act: function() {
// send one or more test messages from Ontario, through the proxy, to the remote end (these are asynchronous messages)
if (me.port(0)) {
me.port(0).msg(103, meName + " " + $wnd.xh.param("TimeStep"), this.cnode);
}
if (this.cnode.first()) {
// a user may accidentally drop some content onto the behavior (this.cnode) node instead of the me node
me.append(this.cnode.first().remove());
}
},
processReceivedMessage: function(msg) {
me.println("processReceivedMessage " + meName + " " + msg.data);
},
// receive messages from a remote source such as PeerjsChat.html
processReceivedSyncMessage: function(msg) {
me.println("processReceivedSyncMessage " + meName + " " + msg.data);
return msg.data.toUpperCase();
}
}
//# sourceURL=Quebecbehavior.js
]]></Quebecbehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg">
<g>
<title>PhysicalSystem</title>
<rect id="PhysicalSystem" fill="#98FB98" height="50" width="50" x="25" y="0"/>
<g>
<title>Universe</title>
<rect id="PhysicalSystem/Universe" fill="#6AB06A" height="50" width="10" x="80" y="0"/>
</g>
</g>
</svg>
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient>
</XholonWorkbook>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment