<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Hot Forest Green</title>
	<atom:link href="http://hotforestgreen.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://hotforestgreen.wordpress.com</link>
	<description>A place for stuff for Smart Spaces</description>
	<lastBuildDate>Tue, 22 Nov 2011 22:12:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='hotforestgreen.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Hot Forest Green</title>
		<link>http://hotforestgreen.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://hotforestgreen.wordpress.com/osd.xml" title="Hot Forest Green" />
	<atom:link rel='hub' href='http://hotforestgreen.wordpress.com/?pushpress=hub'/>
		<item>
		<title>TechDoc: Remote Objects</title>
		<link>http://hotforestgreen.wordpress.com/2011/11/22/techdoc-remote-objects/</link>
		<comments>http://hotforestgreen.wordpress.com/2011/11/22/techdoc-remote-objects/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 21:57:56 +0000</pubDate>
		<dc:creator>Peter Kaptein</dc:creator>
				<category><![CDATA[techdoc]]></category>
		<category><![CDATA[Application Cluster]]></category>
		<category><![CDATA[Remote objects]]></category>

		<guid isPermaLink="false">http://hotforestgreen.wordpress.com/?p=389</guid>
		<description><![CDATA[Basis Remote Objects within HotForestGreen are: Shared &#8211; Over all clients who are connected to the same Application Cluster and stated their interest in them Automatically updated &#8211; When one or more Remote Objects on some other Remote Client send their update to the Application Cluster The Remote Objects are created and sent with the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hotforestgreen.wordpress.com&amp;blog=22795962&amp;post=389&amp;subd=hotforestgreen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Basis</h2>
<p>Remote Objects within HotForestGreen are:</p>
<ol>
<li><strong>Shared</strong> &#8211; Over all clients who are connected to the same Application Cluster and stated their interest in them</li>
<li><strong>Automatically updated</strong> &#8211; When one or more Remote Objects on some other Remote Client send their update to the Application Cluster</li>
</ol>
<p>The Remote Objects are created and sent with the following starting points and concepts to take into mind:</p>
<ol>
<li><strong>Remote Clients</strong> -Each Application connected to the Framework is called a Remote Client</li>
<li><strong>Distributed Applicatons</strong> &#8211; Instead of one application performing all tasks and containing all code, you can create many small applications, each performing specific tasks and each running on multiple systems. The collection of all these local, small and independent applications is called a &#8220;Distributed Application&#8221; where &#8220;distributed&#8221; is used in the sense of &#8220;distributed over multiple places&#8221;. Within these Distributed Applications, all independent applications work together as a team: where each team member performs a specific task, does not specifically needs to know who else is there (limited awareness) and the team as a whole delivers the total end result</li>
<li><strong>Application Clusters</strong> &#8211; Each of your Applications or Remote Clients run in an Application Cluster. The Application Cluster</li>
<li><strong>Remote Data Manager</strong> &#8211; All Remote Objects are managed using the Remote Data Manager. This manager is explained later in this document</li>
<li><strong>Bi-directional Socket Connection</strong> &#8211; Remote Objects are sent over bi-directional Socket Connections</li>
<li><strong>Message based</strong> &#8211; Each update on a Remote Object is sent in a Message over the bi-directional Socket Connection. This message has a Message Header and a Message Body.</li>
<ol>
<li><strong>Message Header</strong> &#8211; The Message Header is a serialized String Array with several parameters, put in a specific and fixed order of appearance. The header in this setup has a relatively low overhead for de-serialization</li>
<li><strong>Message Body</strong> &#8211; The Message Body can contain any content in any structure of your liking. By default the Framework will use its internal Serialization Format which is optimized to reduce overhead on serialization, de-serialization and the number of bytes sent over the network. More about this later</li>
</ol>
<li><strong>Local Data Repositories</strong> &#8211; Each Remote Client will keep a Local Data Repository with all Data Objects</li>
<li><strong>Data Hooks</strong> &#8211; To define which local Object Class of objects will receive what data, you register that physical Object Class to a Data Hook to the Server. Each event on that Data Hook will be pushed to objects in that Object Class</li>
<li><strong>Distributed Event Model</strong> &#8211; Each Remote Client in the Application Cluster registers liseners to specific Data Hooks to specific Application Sandboxes in specific Application Clusters. When some Remote Client sends an update on a specific Remote Object over a Socket Connection to the Application Cluster, the Application Server will dispatch this update to all other Remote Clients registered against that Data Hook. Each registered Remote Client will then automatically receive a Data Push</li>
<li><strong>Serialization and de-serialization</strong> &#8211; To send data over the Socket connection, we serialize and de-serialize that data using a common and shared format. Internally the Framework uses &#8220;Solid Comma Separated Values&#8221; compareable to CSV but with a more solid separator for items/fields/columns and rows. Apart from the serialization format used in the Framework you can use your own via your own custom Data Serializers</li>
<li><strong>Data Serializers</strong> &#8211; As stated HotForestGreen uses an internal format to Serialize and de-serialize data. This process is done via a Data Serializer which is pluggable: meaning that you can create your own Serializer/De-serializer. For the Framework, data is data and as long as all your Remote Objects of that specific class use the same Serialization / De-serialization format it does not matter what fomat you use.</li>
<li><strong>Binary data</strong> &#8211; Bottom line: all data sent over whatever type of Socket connecton is binary data. For most Socket connections and for the Framework this is without any problem</li>
<li><strong>WebSockets</strong> &#8211; HotForestGreen supports WebSockets. WebSockets from version XX support binary data when sent in a separate package.</li>
</ol>
<h2>The Remote Data Manager</h2>
<p>Basis:</p>
<ol>
<li><strong>Application Clusters</strong> &#8211; Application Clusters are the sum of all Remote Clients running in a specific Application SandBox<br />
<strong></strong></li>
<li><strong>Application SandBoxes</strong> &#8211; All Remote Data and Remote Objects run in specific SandBoxes. Each SandBox is a closed environment in which objects and data runs independantly from other Application SandBoxes in your Application and Remote Client. Assumed is that (Remote) Objects in &#8220;SandBox 1&#8243; are not the the same as (Remote) Objects in &#8220;SandBox 2&#8243;. This means that when &#8220;Object 1&#8243; in &#8220;SandBox 2&#8243; receives an update, &#8220;Object 1&#8243; in &#8220;SandBox 2&#8243; will remain unaffected</li>
<li><strong>Multiton Instances</strong> &#8211; The Remote Data Manager is a Multiton, where each Instance of a Remote Data Manager manager the data of the specific SandBox represented by that Remote Data Manager</li>
<li><strong>Persistancy of Remote Objects</strong> &#8211; Each Remote Object is by default a Persistent Object. This means that when &#8220;Person 1&#8243; in &#8220;Sandbox 1&#8243;  is sent to all Remote Clients &#8212; instead of creating a new &#8220;Person 1&#8243;  each time it is received&#8211; all local Objects on all Remote Clients in &#8220;Sandbox 1&#8243;  in your Application Cluster representing &#8220;Person 1&#8243; will automatically be updated by the Remote Data Manager. To do this, each Remote Data Manager holds a Local DataMap</li>
<li><strong>Local Data Repository and Simple Object Database</strong> &#8211; Each instance of the Remote Data Manager holds a Local Data Repository of all Remote Objects registered against a specific SandBox. This Local Data Repository forms the bridge between your local objects and the Remote Data that is received over your Socket Connections. So when the Remote OBject &#8220;Person 1&#8243; is received, it will first be resolved against the Local Data Repository. If it already exists, that specific object will be updated. If it does not exists, a new Local Object will be created and added to the Local Data Repository for all future updates</li>
<li><strong>Messages, Observers and Remote Event Dispatches</strong> &#8211; As stated before, the Framework uses Messages and Remote Event Dispatches. Each Remote Client and each Local Data Repository is in the end an Observer on specific Events dispatched against the HotForestGreen Servers</li>
<li><strong>Local Events and Local Event Dispatches</strong> &#8211; To create a simple basis for updates, the Remote Data Manager offers several hooks to Observe Events on Remote Objects. These hooks are:</li>
<ol>
<li><strong>Added</strong> &#8211; A Remote Object is added to the collection</li>
<li><strong>Updated</strong> &#8211; The Remote Object is updated somewhere in the Application Cluster: either locally or on another Remote Client</li>
<li><strong>Removed</strong> &#8211; The Remote Object is removed from the stack</li>
</ol>
</ol>
<h2>Serialization and de-serialization of Object Data</h2>
<p>This topic is also covered in other posts:</p>
<ol>
<li><strong>Formats to serialize to</strong> &#8211; <a title="TechDoc: Using comma separated values instead of JSON or XML for efficient data transfer" href="http://hotforestgreen.wordpress.com/2011/05/24/techdoc-using-comma-separated-values-for-data-transfer/">Here</a>. About considerating and dropping the use of CSV, JSON and XML and moving towards the SCSV (Solid CSV) format used in HotForestGreen</li>
</ol>
<p>Basis of serialization and de-serialization</p>
<ol>
<li><strong>Sending &#8220;objects&#8221;</strong> &#8211; When you send &#8220;objects&#8221; over any connection, what is really sent is information within and about that object. This information includes:</li>
<ol>
<li><strong>A reference to the object/object class</strong> &#8211; In order to de-serialize, you need to know what your basis is.</li>
<li><strong>The content of that object</strong> &#8211; Being values in variables and other objects nested within that object</li>
</ol>
<li><strong>Serialization</strong> &#8211; When you serialize an object and object structure, you basically iterate through that object (and any sub-object) and read and store all found values into some kind of format. XML could be one. JSON another, your own format yet another. In the end, all objects store basic primitives like Strings, Numbers and Boolean values and your object structure is nothing more than that: a structure to hold your data</li>
<li><strong>De-serialization</strong> &#8211; When you de-serialize data, you translate your &#8220;flattened&#8221; data structure into a (new) object structure that resembles the original you serialized. To do so you need:</li>
<ol>
<li><strong>Object Classes</strong> &#8211; That mirror the Classes (containing the structure) of the objects you serialized. For instance: the class &#8220;Person&#8221;</li>
<li><strong>Shared Class References</strong> &#8211; To resolve the right Object Class to instantiate when re-creating the object structure that was serialized. In most cases this happens by mapping: <em>MyClassMap.addClass(&#8220;PersonClass&#8221;, my.classes.Person.class() )</em>. When we serialize the data, we can include info on the object Class we serialized. For instance: &lt;object classreference=&#8221;PersonClass&#8221; &gt;. Where &#8220;PersonClass&#8221; can be resolved into the Class: Person</li>
<li><strong>References to map the variables</strong> &#8211; To inject the values from the serialized dataset into your object, you need to know where to put that data. For instance: &lt;firstName&gt;John&lt;/firstName&gt; will do that trick, or: &lt;object classreference=&#8221;PersonClass&#8221; firstName=&#8221;John&#8221;&gt;</li>
<li><strong>The code to do the de-serialization</strong> &#8211; In most cases this is done by iteration and reflection, using the structure of your serialized data as starting point: person[ dataItem.name ] = dataItem.value</li>
</ol>
</ol>
<h2>Data Maps and Persistancy of Remote Objects</h2>
<ol>
<li><strong>One single object for one Date Item</strong> &#8211; When you send updates &#8220;person 1&#8243; to all Remote Clients, you want those updates to happen in the one single Data Object you created for &#8220;person 1&#8243; on each Client</li>
<li><strong>Using Data Maps and Object IDs</strong> &#8211; To find objects already created, HFG uses Data Maps to store the objects we create and receive on each type (&#8220;Person&#8221;, &#8220;Car&#8221;). This Data Map has the following layers:</li>
<ol>
<li><strong>SandBox</strong> &#8211; The SandBox in which the data is running. &#8220;Person 1&#8243; in &#8220;SandBox A&#8221; is not the same &#8220;Person 1&#8243; as we find it in &#8220;SandBox B&#8221;</li>
<li><strong>HFG Class Reference</strong> &#8211; When we store the Object Reference, we do that based on the HotForestGreen ClassReference. For instance: the class &#8220;Person&#8221; can be stored under &#8220;PersonClass&#8221; for &#8220;SandBox A&#8221;. &#8220;Car&#8221; can be referred to as &#8220;CarClass&#8221;</li>
<li><strong>Object ID</strong> &#8211; This is the unique ID per object, either created by HotForestGreen or by the Data Provider (a database or your code)</li>
</ol>
<li><strong>Mapping Remote Objects</strong> &#8211; A Remote Object is mapped on the following parameters:</li>
<ol>
<li><strong>Class Reference</strong> &#8211; We need to know to which Class it has to be de-serialized</li>
<li><strong>Object Identifier</strong> &#8211; The name of the variable that contains the Object ID  Record ID</li>
</ol>
<li><strong>Resolving Remote Objects</strong> &#8211; When a Remote Object is received, we use the SandBox ID to access the datamap containing separate Data Maps for each HFG Class Map within that SandBox. Once we have resolved that, we have the final Data Map with references to all existing Data Objects, using the Object ID as the Key to resolve that object from the Data Map</li>
<li><strong>No object found</strong> &#8211; When no object with those keys are found, a new instance will be created by the Remote Data Manager and injected into the Data Map. That new object will then be offered for de-serialization of the data</li>
<li><strong>De-serializing the data</strong> &#8211; When the DataMap Manager returns an Object corresponding the given keys, the de-serialization process can start and the values from the Remote Object can be injected into our local representative</li>
</ol>
<h2>Sending any (registered) object</h2>
<ol>
<li><strong>No specific Extentions needed</strong> &#8211; In an older version of the Framework you had to extend the Remote Object Class to make any object a Remote Object. This process has been removed.</li>
<li><strong>Mapping Local Classes against Remote Object Class References</strong> &#8211; As your Class Structure can differ between projects using and Sharing the same Remote Objects you do need some kind of common name to make the mapping / injection possible. This is done by mapping your local Class agains the Remote Object Class Reference. For instance: &#8220;your.project.classes.Person&#8221; is mapped against &#8220;PersonClass&#8221; in &#8220;SandBox A&#8221;. When you receive Remote Object Data with Class Reference &#8220;PersonClass&#8221;, your mapping will resolve that into your Class: &#8220;your.project.classes.Person&#8221;</li>
<li><strong>Knowing your SandBox</strong> &#8211; One thing you need to do and continue to do is keep tabs on your SandBoxes. There are two ways to do that:</li>
<ol>
<li><strong>Manually</strong> &#8211; You code it into your application. This is the most effecient way for your resources, as you do not need extra processing time to resolve the SandBox</li>
<li><strong>From a Map</strong> &#8211; Each Object you receive and create can be used as a key to map the SandBox it was created for. The advantage is that your application will keep track of where what Object belongs without your further help. The disadvantage is that this costs resources in memory and time to resolve the SandBox from the Map you use</li>
</ol>
<li><strong>Registering persistant objects against a Object/Sandbox Map</strong> &#8211; When you want to use maps to register where your object belongs, you use:</li>
<ol>
<li>RemoteDataManager.mapObject( yourObject, yourSandBox )</li>
</ol>
<li><strong>Sending your object to your SandBox</strong> &#8211; Your object can be sent in the following ways:</li>
<ol>
<li><strong>Using all parameters</strong> &#8211; This is the fastest way as the Framework does not have to waste extra time resolving all implicit data:</li>
<ol>
<li>RemoteDataManager.sendUpdate( yourObject, theSandBox_ObjectClass_ReferenceName, yourSandBox).</li>
</ol>
<li><strong>Using the SandBox name</strong> &#8211; When you only use the SandBox name the Framework will try and resolve the SandBox ObjectClass Reference Name from the Class/Class Reference Name Map you made for that Object, for that SandBox.</li>
<ol>
<li>RemoteDataManager.sendUpdate( yourObject, yourSandBox).</li>
</ol>
<li><strong>Using the Object</strong> &#8211; When you built an Object/SandBox Map, the call is even shorter in code:</li>
<ol>
<li>RemoteDataManager.sendUpdate( yourObject )</li>
</ol>
<li><strong>Using an Extention on the RemoteObject Class</strong> &#8211; Using / extending this Class, you can tell each Object explicitly to which SandBox it belongs and with which Remote Object Class Reference Name it is associated. The call will be moved to the Remote Object itself, to keep coding short and simple:</li>
<ol>
<li>yourObject.sendUpdate()</li>
</ol>
</ol>
</ol>
<h2>Sending lists of Remote Objects</h2>
<ol>
<li><strong>Using an Array or Collection</strong> &#8211; To indicate which Remote Objects you want to send in a List, you place them inside a Array or Collection</li>
<li><strong>Sending the list via the RemoteDataManager</strong> &#8211; As the Array itself does not hold info on where or how to send the objects you use the RemoteDataManager directly, even when your Remote Objects are Extended form the RemoteObject Class. Like this:</li>
<ol>
<li>RemoteDataManager.sendList( yourCollection, theSandBoxClassReferenceID, yourSandBox)</li>
</ol>
<li><strong>All objects of the same Type</strong> &#8211; You can not send a list of mixed types as the Framework will serialize the objects as if they are from the same Class</li>
</ol>
<h2>Serializing nested objects</h2>
<ol>
<li><strong>Any type</strong> &#8211; Nested object can be of any type, including collections of other Objects</li>
<li><strong>Single Objects</strong> &#8211; Any object nested in another object is serialized as a sub-set of that parent object.</li>
<li><strong>Collection </strong><strong>of primitives</strong> &#8211; Primitives like String values and Numeric values are serialized as a sub-set of that Data Object and placed inside the DataRow of the object containing that collection of primitives</li>
<li><strong>Collections of Objects</strong> &#8211; Collections of objects inside an object are not serialized by the Framework. If you need to send collections, you can do two things:</li>
<ol>
<li><strong>Hide the actual Collection and share references</strong> &#8211; Store the actual objects into a private Collection and share a pubic reference list using String values or numbers to resolve the actual objects on the Remote Client side.</li>
<li><strong>Create / download your own Serializer</strong> &#8211; As the Serializer/de-serializers are pluggable, you can create, inject and use your own versions.</li>
</ol>
</ol>
<h2>De-serializing nested objects</h2>
<ol>
<li><strong>Limited implementation</strong> &#8211; The Framework will offer you a very limited implementation of Serialization/de-serialization of Nested Objects. The main reason is that:</li>
<ol>
<li><strong>In most cases more is not needed</strong> &#8211; In most cases you do not a very elaborate Deep Serialization</li>
<li><strong>In those cases you need it: it is not good enough</strong> &#8211; In the cases where you DO need Deep Serialization/Deep de-serialization, your own solutions will be much better than what the Framework might be able to provide</li>
<li><strong>Plug and play: download or write your own</strong> &#8211; The Serializer / De-serializer is a pluggable system. You can inject your own Serializers / De-serializers, state in the Message Headers which specific one you used and skip whatever the Framework might have provided you with your own (downloaded) awesomness</li>
</ol>
<li><strong>Single Objects</strong> &#8211; Using a object- and class reference inside the Main Object, the Remote Object / Data Object that is the result of de-serializin the sub-set belonging to that nested object is put into the Main Object. This process can repeat itself for nested objects inside nested objects</li>
<li><strong>Collections of Objects</strong> &#8211; Collections are de-serialized as a sub-set of that parent object and placed in the collection object of the Main Object. Any existing data in that Collection is replaced in that process. Object references to Data Objects / Remote Objects like &#8220;Person 1&#8243; will be pointing to the exact same object &#8220;Person 1&#8243; as before the purge and replacement of the existing Collection<strong></strong></li>
<ol>
<li><strong>Use references to resolve the Objects</strong> &#8211; If you sent references, the Framework can use the Local Data Map can use to resolve the actual objects. You will need to write your own setters or mechanisms in your Remote Objects to do the actual work, as the Framework will not do that for you</li>
<li><strong>Use your own process</strong> &#8211; See &#8220;Plug and play: download or write your own&#8221; in item 1: &#8220;Limited implementation&#8221; of this list</li>
</ol>
<li><strong>Maps</strong> &#8211; Maps can not be serialized by the Framework. As they can be built up in any way possible, with any type of key possible, they form a potential danger for overhead in both coding and processing. Short and simple: avoid Maps.</li>
<li><strong>Collection </strong><strong>of primitives</strong> &#8211; Primitives like String values and Numeric values are de-serialized and will replace the existing Collection. If your programming language treats primitives as Objects, like Java does, the object references to the String with value &#8220;String 1&#8243; will not be the same as the Object reference of the previous value &#8220;String 1&#8243;</li>
</ol>
<h2>Serializing arrays of primitives like Dates, numbers and Strings</h2>
<ol>
<li><strong>End points</strong> &#8211; Any object that can be considered an &#8220;end point&#8221; will be translated to a String value representing that value.</li>
<ol>
<li><strong>Date/Time</strong> &#8211; For date/time a standard encoding will be used that can be de-serialized in any coding language. The de-serialization is part of the Framework</li>
<li><strong>String values</strong> &#8211; In most languages, Strings are Strings and not Objects. The framework will simply translate Strings to a String value</li>
<li><strong>Numeric values</strong> &#8211; Numbers can be translated to String values and will be so. The decimal-separator will be a dot</li>
</ol>
</ol>
<h2>Receiving and processing Remote Objects</h2>
<ol>
<li><strong>SandBoxes and Sockets</strong> &#8211; For security reasons and scalebility, each SandBox runs in its own and explicit Socket Connection.</li>
<li>Messages &#8211; Each update on Remote Objects is sent in a Message. This Message contains:</li>
<ol>
<li><strong>A Message header</strong> &#8211; Which has been discussed earlier and contains all meta-data for the Server and the Remote Clients</li>
<li><strong>A Message Body</strong> &#8211; Which contains for SCSV:</li>
<ol>
<li><strong>One Header with field names</strong> &#8211; Used to map the values to the variables on the local instances of the Remote Objects</li>
<li><strong>One or more DataRows</strong> &#8211; As a Message can contain data for one or more Remote Objects, we package them in DataRows. Each DataRow contains data for one instances of one specific Remote Object</li>
</ol>
</ol>
<li><strong>Headers and Meta Data</strong> &#8211; Each message we receive on our Sockets contain Meta-Data. This meta-data includes:</li>
<ol>
<li><strong>Remote Object Class Reference Name</strong> -  This is a generic and shared key over all applications using these Remote Objects, to resolve the Serialized data to the right Class</li>
<li><strong>SandBox name</strong> &#8211; Even though we run data within SandBox specific Sockets, we send also the SandBox name with the header.</li>
</ol>
<li><strong>Automated process </strong>- An Extened Remote Object is received and handled automatically. Using the local SandBox and the Remote Object Class Reference Name, the Framework will (try and) resolve the local instance of the Remote Object and once created or found, it will inject the values as sent in the Message Body into the corresponding Local instance of the Remote Object</li>
</ol>
<h2>Optimizing sending lists by using Challenge/Response</h2>
<ol>
<li><strong>Challenge: Remote Client makes generic Data Query</strong> &#8211; For instance: &#8220;give me all people with first name &#8216;John&#8217;.&#8221;<br />
<strong></strong></li>
<li><strong>Response</strong><strong>: Sending IDs only</strong> &#8211; As some, or even most of all Data Objects covering that Query might already be in possession of the Remote Client, sending all Objects again might be overkill. Instead, the first Response can be to send only the IDs of each Data Object, so the Remote Client can refine its request for those Objects not already in the Local DataMap</li>
<li><strong>Challenge </strong><strong>2: Requesting specific DataSets</strong> &#8211; As soon as the Remote Client has resolved which IDs are not yet present in its Local DataMap, it will request the specific dataset by stating the specific Object IDs it requires.</li>
<li><strong>Response 2: Sending requested data</strong> &#8211; Based on the given Object IDs, the Receiver of the Request will send the missing Data Objects</li>
<li><strong>Resolving the Data Objects</strong> &#8211; Once the data is received, the Remote Client will resolve the Data Objects into its local set of Remote Objects</li>
</ol>
<h2>Optimizing Remote Object Handling</h2>
<ol>
<li><strong>Explicit coding</strong> &#8211; The more explicit your coding is, the less the Framework will have to resolve and the faster your processing will be</li>
<li><strong>Extending the Remote Object Class</strong> &#8211; This class allows you to state explicitly per Object to which Class and SandBox it belongs, keeping your code short and simple</li>
<ol>
<li><strong>Instantiating an Extended Remote Object</strong> &#8211; A Remote Object is instantiated in the following way:</li>
<ol>
<li>myRemoteObject = new ExtendedRemoteObject( sandBoxName, sandBboxClassReferenceName )</li>
</ol>
<li><strong>Sending an Extended Remote Object</strong> &#8211; An Extened Remote Object is sent in the following way:</li>
<ol>
<li>myRemoteObject.sendUpdate() ;</li>
</ol>
</ol>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hotforestgreen.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hotforestgreen.wordpress.com/389/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hotforestgreen.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hotforestgreen.wordpress.com/389/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hotforestgreen.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hotforestgreen.wordpress.com/389/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hotforestgreen.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hotforestgreen.wordpress.com/389/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hotforestgreen.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hotforestgreen.wordpress.com/389/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hotforestgreen.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hotforestgreen.wordpress.com/389/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hotforestgreen.wordpress.com/389/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hotforestgreen.wordpress.com/389/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hotforestgreen.wordpress.com&amp;blog=22795962&amp;post=389&amp;subd=hotforestgreen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hotforestgreen.wordpress.com/2011/11/22/techdoc-remote-objects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cffc2ff7b980a5f5f76c22bddba4f361?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">peter kaptein</media:title>
		</media:content>
	</item>
		<item>
		<title>Interview</title>
		<link>http://hotforestgreen.wordpress.com/2011/10/14/interview/</link>
		<comments>http://hotforestgreen.wordpress.com/2011/10/14/interview/#comments</comments>
		<pubDate>Fri, 14 Oct 2011 16:31:14 +0000</pubDate>
		<dc:creator>Peter Kaptein</dc:creator>
				<category><![CDATA[interview]]></category>

		<guid isPermaLink="false">http://hotforestgreen.wordpress.com/?p=374</guid>
		<description><![CDATA[This week (October 11) I was approached by Trevor Harwood from  www.postscapes.com  for an interview. I decided to do it via this post. Here we go: HotForestGreen seems to sit on a perfect intersection between the Maker Movement/DIY shops and the explosion of low cost Android based devices.  Can you briefly speak to the vision behind the project [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hotforestgreen.wordpress.com&amp;blog=22795962&amp;post=374&amp;subd=hotforestgreen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This week (October 11) I was approached by Trevor Harwood from  <a href="www.postscapes.com ">www.postscapes.com</a>  for an interview. I decided to do it via this post.</p>
<p>Here we go:</p>
<p><em><strong>HotForestGreen seems to sit on a perfect intersection between the Maker Movement/DIY shops and the explosion of low cost Android based devices.  Can you briefly speak to the vision behind the project and why you decided to go the Open Source route?</strong></em></p>
<p>I will start with the vision.</p>
<p>When I started developing &#8220;HotForestGreen 0.1 Alpha&#8221; in 2008 I believed that: &#8220;within 5 years, the &#8216;tangible web&#8217; and interactive spaces will be the next big thing&#8221;, using simple RFID tags like the Oystercard and the Dutch &#8220;Public Transportation Chip Card&#8221; as one of the means to start interaction.</p>
<p>In 2008 I felt strongly that that time was <em>now</em>. That this new thing we read about and talked about for years was about to happen. Mainly due to the emergence more and more of low cost hardware and things like RFID cards for things like public transport and due to the increasing availability of all parts (like RFID readers) to fill in the gaps. Because all parts needed to make it work had become mainstream or were about to become mainstream or at least available for consumers like me and you.</p>
<p>I also had this chain of thoughts unrolling like a movie where all unwanted consequences unfolded of a society where your every action and interaction with any of these systems become traceable and recordable.</p>
<p>Rather than to wait for big parties to pick this up and develop centralized, closed and closed-sourced connected solutions to a closed set of private parties and for big parties (think &#8220;Real World Facebook&#8221;) I would love to see something more open and more available for anyone to build on and use.</p>
<p>Apart from the sheer boredom and dread I feel related to the limitation of a centralized vision, I shun away from the lack of innovation any centralized vision has as a byproduct. There are simply too many people involved with too many different agendas.</p>
<p>To give you a simple example: when the Web emerged, AOL and the likes assumed that Catered Portals were the start and endpoint of your Internet experience. These portals would be managed by their people, with the content <em>they</em> thought would be interesting for <em>you</em>. To keep it short: If the web would have stayed like that sites and services like Amazon, Facebook, WikiPedia and Twitter would never have emerged on the web the way they did now: because the internet as we know it has been created in an open garden.</p>
<p>I want the &#8216;tangible web&#8217; (where whatever happens online in your personal data-cloud can be presented in a physical space) to become reality by the power of the people. To become reality with things people created in their own homes. I want to see the ideas that really kick ass emerge into the mainstream with the potential to really change and improve part of our lives in ways we can not imagine now.</p>
<p>Android is only one point of entry, as it meets most of the items on the list below:</p>
<div>
<ol>
<li><strong>Low cost</strong> &#8211; Obtainable below 100 euro</li>
<li><strong>Open</strong> &#8211; In standards, hardware used, platforms that can be hooked to it</li>
<li><strong>Easy to get</strong>  &#8211; You can buy it in &#8220;any&#8221; shop around the corner</li>
<li><strong>With all basics to get started</strong> &#8211; WiFi/Network capabilities, screen (or the possibility to connect one), USB port and some means of human input (keyboard, touch screen, the possibility to connect keyboard and mouse)</li>
<li><strong>Easy to program</strong> &#8211; Using &#8211; preferably &#8211; tools that you already use in coding: like Eclipse and the likes</li>
<li><strong>Capable of running more complex processes</strong> &#8211; Which means a reasonably powerful CPU and enough RAM and storage</li>
<li><strong>Easy to extend</strong> &#8211; Think of IO boards and the likes</li>
</ol>
</div>
<p>The most important goal to me is to make the project and the experiments that will follow easy and even inviting for others to reproduce and to use as a starting point for whatever you want to do yourself. Android, with more and more phones and tablets moving towards the 100 euro threshold is one point of entry. Low cost Netbooks (200 euro) is another.</p>
<p><a href="http://www.raspberrypi.org/?page_id=2">RaspberryPI </a>is yet another project I am watching. When you see that tiny, low cost $25 ARM11 computer running Quake 3 under Linux on a big screen (<a href="http://www.raspberrypi.org/?p=106">see here</a>), that is quite impressive.</p>
<p>More than Android devices I think RaspberryPI will be an exploding supernova among tinkerers.</p>
<p>When you look at my priorities in development and platform choice, I use a simple funnel: Most people understand MS Windows and Android and Netbooks and phones and tablets and what you can (potentially) do with that. Lesser people get Linux. Even lesser amounts of people understand projects like Arduino and how to overcome the limitations of that platform. Apple for me is more and more a closed platform with (for the iDevices) a programming language I do not have the time to learn. For visual stuff, Flash still is the best choice to go for me, as I used that platform for several years and it runs on Android, Windows and Linux. So that is what my focus and prioritization is based on in the development of the HotForestGreen platform and the HFG demos that will emerge in the next months.</p>
<p>The project is Open Source for several reasons. One is related to the vision above. I simply want that &#8220;open garden&#8221; to emerge, as unstoppable as it happened for HTML and web development. Another is my lack of business skills. I tried to start several companies in the past 20 years and all that is needed to run a business simply does not match with my mental DNA. Instead of trying to keep things closed and secret and try to become one of the &#8220;five&#8221; major players in this field, I simply build, experiment, document, bring it to the open and see what emerges and whatever like-minded people I find.</p>
<p><em><strong>HFG can be used for a wide range of Internet of Things developments, but can you give some examples of  projects or people that this framework would ideally be suited for?</strong></em></p>
<p>Home automation is one. Think of DIY Home State monitoring where every Event and State from doors and windows and stuff inside the house (fridges, heating, room temperature, lighting) can be checked and recorded and changed. Where you can check if the light in the bathroom is still on from the bedroom and switch it of using either your phone, tablet or laptop as all connect to the same shared interface.</p>
<p>Another is Real Time Collaboration in Application Clusters where what I do can be shared with what you do and where we can work together on the same things from different locations. One practical example in this is the care-industry (dentists, home doctors, hospitals) where people at the reception can prepare your workstation at the place where you treat your client so that you can focus on the client without the distractions of the system.</p>
<p>On a bigger scale you can think about care-centers where people with disabilities and/or of old age can be monitored so that &#8212; when something goes wrong &#8212; helpers are immediately notified when something <em>seems</em> wrong and help is only 30 minutes away instead of: &#8220;whenever you can reach that panic button at the other side of the room&#8221;.</p>
<p>Also on this and even bigger scale can be construction sites and factories where multitudes of low cost sensors observe the environment and potential hazards and in which you are alerted when your current or future location can become an (immediate) hazard due to some changes or (system) failure or due to some vehicle rushing unseeingly your way.</p>
<p>On a small scale, it can help people to setup very scalable Real Time systems in a very short time. Think of a chat-box as one of the most primary and simple implementations and any of the examples above when you needs or plans are more ambitous.</p>
<p>Looking at the target audience: the framework is designed to cater beginners with simple &#8220;Hello World&#8221; Real Time applications running on a Netbook to the very advanced users who need Load Balancing and multiple Clusters running on multiple locations all over the world, in several layers over encrypted connections with fallback-scenarios and alternative routes for &#8220;Plan B&#8221; and &#8220;Plan C&#8221; and fallback scenarios for several HFG Server Failures where not even one byte of data should get lost during those events.</p>
<p><em><strong>You have recently been working on implementing WebSockets in the project. Do you have any other favorite or important project features that you could share more about? </strong></em></p>
<p>One of the most important next steps is to create Virtual Representants of Arduino and XBee modules. A Virtual Representants represents the real object on any remote client &#8220;as if&#8221; it is that real object. They are something like the marriage of a Proxy and a Mediator.  Once the framework is finished it has to be very easy to start working with either Arduino and XBee (and any other device I find time to represent in code). What these Virtual Proxies involve is the following:</p>
<div>
<ol>
<li><strong>One simple basic object in code to represent the device</strong> &#8211; In the end, an Arduino and XBee module are simple devices with a fixed set of ports that either allow you to read values (from sensors and so on) or to set values (on/off or a specific voltage between zero and X).<br />
<strong></strong></li>
<li><strong>Local = remote / remote = local</strong> &#8211; When you communicate to a local &#8220;Virtual&#8221; version of an Arduino module or XBee module, it should be as if you are communicating to it directly. All updates you make on the local Virtual Object should be reflected remotely and the other way around.</li>
</ol>
</div>
<p><em><strong>What&#8217;s next?  What would be the best way for readers to find out about the latest developments?</strong></em></p>
<p>I follow Engadget and Hack a Day at this moment. They represent about 80% of all stuff that bubbles up of what I might find interesting. Apart from that, I use Google. Depending on my need at that point and the things I want to build, I search the web until I find what I need.</p>
<p><em><strong>Could you go into anymore detail about the next stage in HFG development?  i.e: possible release dates or if you are looking for any contributions from other programmers, etc?</strong></em></p>
<div>
<div>
<p>The phasing (and fictional from #2, as there is no funding) timeline for HotForestGreen is as follows:</p>
<div>
<ol>
<li><strong>Realization and finalization of the base version</strong> - Started in may 2011. This will be behind closed doors. Simply because I need that quiet to do what I want to do</li>
<li><strong>Release to the open</strong> - For now set on January 14, 2012. I hope earlier, but January 14 is a nice date to work towards. This phase will include promotion on several sites and lists and the release of the code on GitHub</li>
<li><strong>Creation and finalization of my own prototypes</strong> - Somewhere before the end of January. These are the projects I have in mind already andones that will emerge in the next period</li>
<li><strong>Watch the wild flowers bloom</strong> - 2012. Once other people start picking up the Framework, anything can happen, including several spin-off frameworks going their own directions and many projects emerging with really unexpected results and starting points</li>
<li><strong>Consolidation</strong> - 2012, 2013. From that point I will start forming my own team for my branch of HotForestGreen</li>
<li><strong>New developments and new business</strong> - Like the web in 1995, things like HotForestGreen are just the first steps into what will very likely be an entire new line of business started from several home brew projects that will disrupt whatever is here now. The tinkerers you can find on sites like: &#8221; Hack A Day&#8221; and &#8220;Make&#8221;, being the ones who will shift those worlds and who build the stuff nobody has built before and make awesome new businesses out of that &#8212; becausse they are smart, because it is affordable and because they can</li>
</ol>
</div>
</div>
<p>I am currently at phase 1, which was planned to end in September, but is delayed until the beginning of 2012.  I had some deadlines running (<a href="http://hotforestgreen.wordpress.com/category/update/">see the updates here</a>), but reality took over due to the pending possible crisis (2011/2012). I decided &#8212; instead of taking my planned sabbatical from Juli to December &#8212; to take another freelance gig to pot up some more financial buffers for 2012.</p>
<p>On the short term &#8212; in between other priorities &#8212; I only have time for short bursts of creativity, like <a href="http://beyondthekeeboard.wordpress.com/2011/10/05/bigscreen-android-with-touch/">this one</a>: modding a <del>23</del> 22 inch Touch Panel to work as an Android Touch Screen.</p>
<p>So: with some precaution, the first code release with &#8220;Hello world&#8221; examples and documentation, will be on Januari 14.</p>
<p>To follow the development of HotForestGreen, several lines can be followed. <a href="beyondthekeeboard.wordpress.com">Beyond the Keyboard</a> is one of them. There I post my hardware-experiments which all are aimed to support the hardware side of the framework: <a href="http://beyondthekeeboard.wordpress.com/category/touch/">Touch screens</a>, <a href="http://beyondthekeeboard.wordpress.com/category/2-articles/hardware-as-commodity/">hardware as a commodity</a> and the possibilities of that low cost/high tech hardware, research at the possibilities of Android (&#8220;<a href="http://beyondthekeeboard.wordpress.com/category/1-series/hacking/hacking-android/">Hacking with Android</a>&#8220;) and other platforms and a irregular <a href="http://beyondthekeeboard.wordpress.com/2011/06/23/price-level-list-june-2011-low-budget-hardware-for-tinkering/">price watch</a> trying to keep tabs on what you can get where for how much.</p>
</div>
<div>
<p>Another is this HotForestGreen blog, which documents my progress and my actions.</p>
<p>To help me speed up and keep me from restating my priorities, it helps to know that there are people who care about this project and who are waiting for something like HotForestGreen. Simply ping me and post something nice and supportive will be enough.</p>
<p>If people do want to stay in touch, they can simply state and I will add them to my e-mail list.</p>
<p>When phase 2: &#8220;Release to the open&#8221; starts, I believe things will start happening from the outside in. So: am I looking for contributions from other programmers? Definately! It is one of the main reasons why I am refactoring my code so much as I do now. Better to invite guests into a clean house then one that has never been cleaned up at all.</p>
<p>For now, I have nothing more to offer but what I create and what I write about online.</p>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hotforestgreen.wordpress.com/374/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hotforestgreen.wordpress.com/374/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hotforestgreen.wordpress.com/374/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hotforestgreen.wordpress.com/374/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hotforestgreen.wordpress.com/374/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hotforestgreen.wordpress.com/374/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hotforestgreen.wordpress.com/374/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hotforestgreen.wordpress.com/374/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hotforestgreen.wordpress.com/374/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hotforestgreen.wordpress.com/374/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hotforestgreen.wordpress.com/374/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hotforestgreen.wordpress.com/374/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hotforestgreen.wordpress.com/374/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hotforestgreen.wordpress.com/374/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hotforestgreen.wordpress.com&amp;blog=22795962&amp;post=374&amp;subd=hotforestgreen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hotforestgreen.wordpress.com/2011/10/14/interview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cffc2ff7b980a5f5f76c22bddba4f361?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">peter kaptein</media:title>
		</media:content>
	</item>
		<item>
		<title>Update: August 3 &#8211; WebSockets, holiday, flu, Design Patterns and IP</title>
		<link>http://hotforestgreen.wordpress.com/2011/08/03/update-august-3-websockets-holiday-flu-design-patterns-and-ip/</link>
		<comments>http://hotforestgreen.wordpress.com/2011/08/03/update-august-3-websockets-holiday-flu-design-patterns-and-ip/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 18:40:04 +0000</pubDate>
		<dc:creator>Peter Kaptein</dc:creator>
				<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://hotforestgreen.wordpress.com/?p=371</guid>
		<description><![CDATA[Summary Flu struck me this week. Other priorities &#8211; when returning from Italy to Holland &#8211; last week. Holiday the week for that. In the holiday I studied Design Patterns, Intellectual Property and Open Source licences to increase my knowledge on two fields I know just a little about. Just before holiday I finialized the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hotforestgreen.wordpress.com&amp;blog=22795962&amp;post=371&amp;subd=hotforestgreen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Summary</h2>
<p>Flu struck me this week. Other priorities &#8211; when returning from Italy to Holland &#8211; last week. Holiday the week for that.</p>
<p>In the holiday I studied Design Patterns, Intellectual Property and Open Source licences to increase my knowledge on two fields I know just a little about.</p>
<p>Just before holiday I finialized the first proof of concept for WebSockets, establishing a two way Socket connection with Remote Objects in JavaScript, running in Chrome.</p>
<h2>Design Patterns</h2>
<p>Whether I use them or not, to know what they are and what makes what pattern what is quite relevant I think. It will improve my own coding and the results you will download when you want to contribute on this project.</p>
<p>To assure I will own the knowledge I started to map them and write <a href="http://flashworks.wordpress.com/category/design-patterns/">blog posts on Design Patterns</a>.</p>
<h2>Intellectual Property and Open Source Licenses</h2>
<p>Choosing which Open Source License will apply will also determine how useful the code will be for others and how many people will <em>not</em> contribute.</p>
<p>The goal is to go for a licence that is as open as possible, allowing both open and closed projects and both commercial and non-commercial projects to happen, where the only restriction is that you respect the authors and the work itself.</p>
<h2>Git or SVN?</h2>
<p>Many projects I know have moved from SVN to Git repositories. Apparently Git is the new shit.</p>
<p>Instead of sticking to what I know, I decided to drop SVN for Git.</p>
<p>I have been considering maintaining two repositories, by mirroring the base libraries to a Git and SVN repository, but SVN for sure will freak out when files suddenly disappear while they are still registered in the local .svn lists. So Git it will be. And ZIP files for those who want to just download the code base.</p>
<h2>WebSockets</h2>
<p>As you might have read, I consider WebSockets to be of importance for the framework. First of all, because it allows you to build applications in the browser, without the need of any compiler or special IDE.</p>
<p>Second, WebSockets might help solve the issue of specific settings on Firewalls, blocking any traffic that is not HTTP or FTP.</p>
<p>I run some successful tests in Chrome with a simple chat and tracing system, showing me connection state and events and activity on the Browser side.</p>
<h2>Next steps</h2>
<p>I hope to pick up steam again in the next week. The total of three weeks not being productive on HotForestGreen was not foreseen.</p>
<p>The new deadlines are now set to:</p>
<ol>
<li>September 1st &#8211; Release of the C# and JavaScripr code base and several demos to get started</li>
<li>October -</li>
</ol>
<h2>Older Status Updates</h2>
<ul>
<li><a title="Update: Phase 1 of HotForestGreen almost done, implementing authentication" href="http://hotforestgreen.wordpress.com/2011/06/01/update-phase-1-of-hotforestgreen-almost-done-implementing-authentication/">June 1</a>: Prototype code for first phase of HotForestGreen almost done, implementing authentication</li>
<li><a title="Update: First round trip test successful" href="http://hotforestgreen.wordpress.com/2011/06/13/update-first-round-trip-test-successful/">June 13</a>: First round trip successful</li>
<li><a title="Update: June 19 – Getting a grip on all things considered" href="http://hotforestgreen.wordpress.com/2011/06/19/update-june-19-getting-a-grip-on-all-things-considered/">June 19</a>: Gettign a grip on all things considered. After a round of high-impact refactorings, things got to the point of functional again. Also contains a lot of background info on SandBoxes, the new security model, Systems of Trust and the revised Auto Connect system.</li>
<li><a title="Update: July 5 – First tests with Remote Objects in the refactored code" href="http://hotforestgreen.wordpress.com/2011/07/05/update-july-5-first-tests-with-remote-objects-in-the-refactored-code/">July 5</a>: First tests with Remote Objects in the refactored code. After a thorough refactoring, I tested if the basis is still working.</li>
<li>Agust 3 &#8211; This post</li>
</ul>
<h2>What is this Framework about?</h2>
<p>See the post of <a title="Update: June 19 – Getting a grip on all things considered" href="http://hotforestgreen.wordpress.com/2011/06/19/update-june-19-getting-a-grip-on-all-things-considered/">June 19</a>. See also the &#8220;About&#8221; page <a href="http://hotforestgreen.wordpress.com/about/">here</a>.</p>
<h2>Update on roadmap</h2>
<h2><em>Phase 1: Building the basis – In progress per May 4, 2011</em></h2>
<p>Before June 10, 2011 I hope to finish Phase 1, which covers the basics on data, data conversion and Client/Server and Client/Client messaging. This includes:</p>
<ol>
<li><strong>Remote Objects</strong> – Sending and updating Remote Objects to all Remote clients</li>
<ol>
<li><em><strong>Status: June 19, 2011</strong></em></li>
<ol>
<li>Basis is tested last week. Found some bugs in retrieving persistant objects, leading to creation of news ones instead of retrieving the old</li>
<li>Need to be retested. Will be done in the next 2 weeks.</li>
</ol>
<li><em><strong>Status: July 5, 2011</strong></em></li>
<ol>
<li><strong>Bug: Echo from own data</strong> - Remote Objects seem to receive an echo from their own sent update. This is unwanted behavior.</li>
<li><strong>Bug: Application crashes</strong> - As Visual Studio rather crashes than show me which exception is not handled, it is hard to find what is going on. It is probably related to the Remote Objects.</li>
<li><strong>Test: Synchronized Browsers succesful</strong> - I have tested the Remote Objects in a simple experiment with synchronized browsers.</li>
<li><strong>Improvement of Event Model</strong> - The Remote Objects are receiving a more and more sophisticated Event Model, making it easier to monitor what is going on.</li>
</ol>
</ol>
<li><strong>Server feedback</strong> – Including IP numbers of Servers serving specific sandboxes</li>
<ol>
<li><em><strong>Status: June 19, 2011</strong></em></li>
<ol>
<li>Tested and in revision now. Refactored to make the message in standard BaseMessage format. Will do more refactoring today to revise the process of: &#8220;knock knock, who&#8217;s there?&#8221;</li>
</ol>
<li><em><strong>Status: July 5, 2011 </strong></em></li>
<ol>
<li>No progress.</li>
</ol>
</ol>
<li><strong>Heartbeats and auto-reconnect</strong> – Including auto-discovery of services and sandboxes and auto-reconnects when a Client connection drops or a Server drops out</li>
<ol>
<li><em><strong>Status: June 19, 2011</strong></em></li>
<ol>
<li>Revised to be independent of Servers running. To be tested in a Server Cluster.</li>
</ol>
<li><em><strong>Status: July 5, 2011</strong></em></li>
<ol>
<li><strong>Bug fix: Static timer</strong> - The timer used for the heartbeat of the SandBoxes only dealt with one of all registered sandboxes, as it was a static instead of a local variable.</li>
<li><strong>Preparation for multi-tier servers</strong> - To support multiple port numbers the SandBox connector is updated. Tests today to make it work properly have been cancelled. To be picked up later as it is only a priority to test Server to Server communication.</li>
<li><strong>Test</strong> - Auto connect seems to work fine. Within 20 seconds of a Server becoming available, the separate applications are synchronizing Remote objects.</li>
</ol>
</ol>
<li><strong>User Authentication</strong> – Including a basic “plug and play” scenario for logging into SandBoxes and assuring messages sent from a Client are “signed” by the user Credentials</li>
<ol>
<li><em><strong>Status: June 19, 2011</strong></em></li>
<ol>
<li>No further progress</li>
</ol>
<li><em><strong>Status: July 5, 2011</strong></em></li>
<ol>
<li>No progress</li>
</ol>
</ol>
<li><strong>Data manipulation</strong> – Using a “plug and play” approach via: “Transparant Data Access Layers” to access, change and store data in databases</li>
<ol>
<li><em><strong>Status: June 19, 2011</strong></em></li>
<ol>
<li>Tested first version three weeks ago. To be revisited after finalizing items 1 to 4.</li>
</ol>
<li><em><strong>Status: July 5, 2011</strong></em></li>
<ol>
<li>No progress</li>
</ol>
</ol>
<li><strong>Data Conversion</strong> – Including the conversions of Objects to “Comma Separated Values” vice versa, in order to:</li>
<ol>
<li><strong>Send updates</strong> – On Remote Objects through the network</li>
<li><strong>Reduce code for working with Databases</strong> – As we can inject data from databases into objects and database records</li>
</ol>
</ol>
<div>When these main items are done, I can release the code and start building some proof of concepts, showing the possibilities of the framework.</div>
<h2><em>Phase 2: Securing the framework – Started per June 16</em></h2>
<p>Phase 2 is about making the Framework more solid and more protected against people who want to hijack data and events.</p>
<ol>
<li><strong>Server to Server updates</strong> – Including: “I am currently serving Sandboxes A, B and C with a total of N connections”</li>
<ol>
<li><em><strong>Status: June 19, 2011</strong></em></li>
<ol>
<li>Started implementation of Secured SandBoxes to make this possible and simple</li>
<li>Implemented Server Sate Manifest as a Remote Object that contains the data per Server and automatically updates all other Servers when the state on that Server changes</li>
</ol>
<li><em><strong>Status: July 5, 2011</strong></em></li>
<ol>
<li><strong>Bug fix: Secret sandboxes not registered properly</strong> - Due to a bug in the refactored code, allowing for the creation of three different sandboxes: Open/Public, Trusted/Public  and Hidden, the Internal Server Manafest was not sent and received properly. This bug has been fixed yesterday.</li>
<li><strong>Other progress</strong> - Briefly tested, except from the bug fix, no progress made</li>
</ol>
</ol>
<li><strong>Load Balancing</strong> – Including a smart distribution of Sandboxes so that the load to serve Clients is shared by many</li>
<ol>
<li><em><strong>Status: June 19, 2011</strong></em></li>
<ol>
<li>Implemented, not tested yet. When a Client requests an IP number, the Client Socket will provide the IP of the Server that is least loaded.</li>
</ol>
<li><em><strong>Status: July 5, 2011</strong></em></li>
<ol>
<li>No progress made</li>
</ol>
</ol>
<li><strong>Server to Server security</strong> – Using handshakes and shared keys. Assuring that when a user plugs in a “Server” to intercept messages and sandboxes, this “Server” is refused by the network</li>
<ol>
<li><em><strong>Status: June 19, 2011</strong></em></li>
<ol>
<li>Work in progress. Servers now build up a Secured SandBox using the exact same mechanism as Clients, with the difference that they use an internal Shared Keyword to test if they can Trust the other Server</li>
</ol>
<li><em><strong>Status: July 5, 2011</strong></em></li>
<ol>
<li><strong>Trust relationships seem to work</strong> - The basic principle has been tested and trust-relationships seem to work. Connections are refused when a Client Server can not be trusted and three different type of SandBox Connections have been defined. See &#8220;Server to Server updates&#8221; under the update of July 5, 2011.</li>
<li><strong>More testing required</strong> - To be sure that the code is solid, more testing is required.</li>
</ol>
</ol>
<li><strong>SSL encryption</strong> – Currently all data sent is in Clear Text, making it extremely easy to hijack and abuse the system</li>
<ol>
<li><em><strong>Status: June 19, 2011</strong></em></li>
<ol>
<li>Not started yet</li>
</ol>
<li><em><strong>Status: July 5, 2011</strong></em></li>
<ol>
<li>Not started yet</li>
</ol>
</ol>
</ol>
<p>When these items are done, the Framework can withstand most basic attacks, can be scaled up by hot-plugging new Servers in the network and will continue to work even when multiple servers drop out.</p>
<h2><em>Phase 3: Opening up the framework – Started </em></h2>
<p>While the basis is for specific use in a controlled environment, some things are missing to make the framework even more useful. These include:</p>
<ol>
<li><strong>The use of Web-sockets</strong> – For Socket-communication over port 80 in environments behind firewalls</li>
<ol>
<li><strong><em>Status: August 3</em></strong></li>
<ol>
<li>WebSocket Server is working for current implementation / protocol.</li>
</ol>
</ol>
<li><strong>Porting the code from C# to Java and ActionScript</strong> – To provide a broader use base, allowing you to run the framework on:</li>
<ol>
<li> Android, Apple, Linux and in Flash</li>
<li>Intel and ARM-based devices</li>
</ol>
</ol>
<div>Other possibly needed ports I will leave up to the community that will hopefully emerge. I simply do not have the time.</div>
<h2><em>Phase 4: Testing and cleaning up – Not started yet</em></h2>
<p>In Phase 4 all crap and remaining leaks will be filtered out of the system. During phase 2, most issues have been tested and addressed, but as a part of the process.</p>
<p>The work includes:</p>
<ol>
<li><strong>Testing specific use-cases for performance</strong> - By running as much connections and messages as possible, until the system collapses</li>
<li><strong>Testing possible ways to hijack users and data</strong> – By scrutinizing the security model and implementing code that should break it</li>
<li><strong>Improving performance</strong> – By taking away data-hogs and</li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hotforestgreen.wordpress.com/371/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hotforestgreen.wordpress.com/371/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hotforestgreen.wordpress.com/371/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hotforestgreen.wordpress.com/371/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hotforestgreen.wordpress.com/371/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hotforestgreen.wordpress.com/371/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hotforestgreen.wordpress.com/371/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hotforestgreen.wordpress.com/371/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hotforestgreen.wordpress.com/371/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hotforestgreen.wordpress.com/371/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hotforestgreen.wordpress.com/371/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hotforestgreen.wordpress.com/371/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hotforestgreen.wordpress.com/371/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hotforestgreen.wordpress.com/371/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hotforestgreen.wordpress.com&amp;blog=22795962&amp;post=371&amp;subd=hotforestgreen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hotforestgreen.wordpress.com/2011/08/03/update-august-3-websockets-holiday-flu-design-patterns-and-ip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cffc2ff7b980a5f5f76c22bddba4f361?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">peter kaptein</media:title>
		</media:content>
	</item>
		<item>
		<title>TechDoc: OOP in JavaScript</title>
		<link>http://hotforestgreen.wordpress.com/2011/07/11/techdoc-oop-in-javascript/</link>
		<comments>http://hotforestgreen.wordpress.com/2011/07/11/techdoc-oop-in-javascript/#comments</comments>
		<pubDate>Mon, 11 Jul 2011 12:03:28 +0000</pubDate>
		<dc:creator>Peter Kaptein</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hotforestgreen.wordpress.com/?p=356</guid>
		<description><![CDATA[Introduction From my point of view &#8211; using Java, ActionScript 3 and C# &#8211; JavaScript is not an Object Oriented Programming language. You can not create explicit classes, explicitly define static variables and methods and the definition and instantiation of an Object is&#8230; &#8230;awkward. Base article Javascript and OOP &#8211; by Tim Scarfe: Creating &#8220;Classes&#8221; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hotforestgreen.wordpress.com&amp;blog=22795962&amp;post=356&amp;subd=hotforestgreen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>From my point of view &#8211; using Java, ActionScript 3 and C# &#8211; JavaScript is not an Object Oriented Programming language.</p>
<p>You can not create explicit classes, explicitly define static variables and methods and the definition and instantiation of an Object is&#8230; &#8230;awkward.</p>
<p>Base article</p>
<ol>
<li><strong>Javascript and OOP</strong> &#8211; by Tim Scarfe:</li>
<ol>
<li><strong>Creating &#8220;Classes&#8221; and extending them with methods</strong> &#8211;  <a href="http://www.javascriptkit.com/javatutors/oopjs2.shtml">See here</a></li>
</ol>
<li><strong>Object orienting programming in JavaScript</strong> &#8211; By Mike Koss.</li>
<ol>
<li><strong>Super and sub-classes</strong> &#8211; Describing the object prototype-chain and how to use and &#8220;extend&#8221; the prototype of an object.  <a href="http://mckoss.com/jscript/object.htm">See here</a></li>
</ol>
</ol>
<h2>Packages</h2>
<p>What I found missing is the use of Class Packages and Package Chains. So I created my own library for that kind of stuff.</p>
<h2>Functions, function body and function scope</h2>
<p>One way to pretend OOP in JavaScript is by using a method or function as the constructor and &#8220;Class&#8221; body.</p>
<p>Like this:</p>
<pre><span style="color:#008000;">// JavaScript "class" Cat</span>
function cat(name) {
<span style="color:#008000;"> // Returns an object that we can extend with methods</span>
   this.name = name;
   <span style="color:#008000;">// Methods are defined like this</span>
   this.talk = function() {
	alert( this.name + " say meeow!" )
   }
} 

<span style="color:#008000;">// Example code of use</span>
cat1 = new cat("felix")
cat1.talk() //alerts "felix says meeow!"</pre>
<h2>Extending objects and creating Classes via prototyping</h2>
<p>Prototyping is another way to extend a &#8220;Class&#8221;.</p>
<p>Instead of cramming the constructor method/body with other methods, we extend the base method by extending its prototype.</p>
<p>Unlike Java and C# there is no limit or limitation where and when you do this. As long as you are inside the same (root) scope as the method or object you extend.</p>
<pre><span style="color:#008000;">// JavaScript "class" Cat</span>
function cat(name) {
   // Returns an object that we can extend with methods
   this.name = name;
}
<span style="color:#008000;">// Extend the base constructor with methods via the prototype</span>
cat.prototype.talk=function(){
<span style="color:#008000;"> // Due to the prototype we are in scope </span>
<span style="color:#008000;"> // of the object made via the cat-method</span>
   alert( this.name + " say meeow!" ) 
}</pre>
<h2>Super and sub-Classes</h2>
<p>Each object returned by a function is of base type Object.</p>
<p>When you create a method, this method implies a new (derived) object which can be extended via its prototype as we did above.</p>
<p>Knowing this we can do the following with &#8220;cat&#8221;:</p>
<pre><span style="color:#008000;">// Constructor </span>function Cat( name )
{
    this.name=name;
} 
<span style="color:#008000;">// Extending the prototype of cat by injecting Animal into the prototype </span>Cat.prototype=new Animal();
<span style="color:#008000;">// Making sure the constructor on the object is Cat </span>Cat.prototype.constructor = Cat;</pre>
<h2>Creating packages</h2>
<p>By default JavaScript uses a flat structure, without the Package Chains we know from OOP languages like Java or C#.</p>
<p>As I need this for a better structuring of the HotForestGreen JavaScript Library, I started the creation of a small OOP library for that today.</p>
<p>It extends the basic JavaScript Object with the method: getPackage( packageName);</p>
<p>As any object &#8211; including the JavaScript object delimiterd by &lt;script&gt;&lt;/script&gt; &#8211; is a JavaScript Object, the call to resolve a package looks like this:</p>
<pre><span style="color:#008000;">// Get package reference - this is similar to "include" or "using"</span>
var <span style="color:#ff0000;">package</span> = <span style="color:#0000ff;">this</span>.<span style="color:#ff0000;">getPackage</span>("<span style="color:#0000ff;">peter.kaptein.package</span>")

<span style="color:#008000;">// Create the "Class" and constructor in the package</span>
<span style="color:#ff0000;">package</span>.<span style="color:#0000ff;">MyClass</span> = <em>function</em> () {
	alert("<span style="color:#0000ff;">MyMethod constructor</span>")
}

<span style="color:#008000;">// Define a method in our "Class"</span>
<span style="color:#ff0000;">package</span>.<span style="color:#0000ff;">MyClass</span>.<span style="color:#0000ff;">prototype</span>.<span style="color:#ff0000;">findMe</span> = <em>function</em> () {
	alert("<span style="color:#ff0000;">found me</span>")
}

<span style="color:#008000;">// Creating a new object with our nested Class</span>
var <span style="color:#0000ff;">object</span> = new <span style="color:#ff0000;">package</span>.<span style="color:#0000ff;">MyClass</span>()
<span style="color:#0000ff;">object</span>.<span style="color:#ff0000;">findMe</span>(); <span style="color:#008000;">// returns : "found me"</span></pre>
<h2><em>Result &#8211; still awkward, but better</em></h2>
<p>Defining classes still feels very awkward, as I am used to state something like this:</p>
<pre><span style="color:#008000;">// ActionScript package definition </span>package <span style="color:#0000ff;">package.chain.somepackage </span>{
<span class="Apple-style-span" style="color:#008000;"> // Class definition</span>
     public class <span style="color:#ff0000;">MyClass </span>     {
            <span style="color:#008000;">// Constructor and Class Body go here</span>
    }
}</pre>
<p>Using packages &#8211; which are retrieved and referred to using a simple method &#8211; however, makes it easier to store specific classes in specific place holders and create cleaner code.</p>
<p>It also prevents me from accidently overwriting other Classes which might do the same but nor really <em>are</em> the same.</p>
<h2>Package naming and reference</h2>
<p>Using meaningful names helps creating a second layer of neatness.</p>
<pre><span style="color:#008000;">// Not really meaningful is the following</span>
var <span style="color:#0000ff;">bla</span> = this.<span style="color:#ff0000;">getPackage</span>("<span style="color:#0000ff;">bli.bla.bloo</span>"); 
<span style="color:#008000;">// which represent out super awesome Socket Stuff</span></pre>
<p>Is less meaningful than:</p>
<pre><span style="color:#008000;">// A clear naming </span>
var <span style="color:#0000ff;">sockethandlerPackage</span> = this.<span style="color:#ff0000;">getPackage</span>("<span style="color:#0000ff;">network.sockets.handlers</span>");
<span style="color:#008000;">// So we know what we talk about</span></pre>
<h2>Reflection and lack of reflection</h2>
<p>Unfortunately JavaScript does not support something like Strong Typing.</p>
<p>Everything we use is an generic object, and can change its type on run time.</p>
<p>This means that:</p>
<ol>
<li><strong>Limited reflection</strong> &#8211; The editor you are using &#8211; and if it supports some sort of reflection &#8211; will only know what is in scope of a specific object due to its prototypes.</li>
<li><strong>No sanity checks on pre-compiling</strong> &#8211; Whatever methods and variables you call on an object: only when the application runs you will know if your code will break.</li>
</ol>
<p>This means whatever we create based on a improvised OOP approach can only be tested on run time.</p>
<h2>Assuring clean Package Chains</h2>
<p>We want &#8220;some.nice.class.package.mypackage&#8221; to use the exact same Package Chain as &#8221;some.nice.class.package&#8221;.</p>
<p>To assure a clean package chain we use:</p>
<ol>
<li><strong>Global lookup table with Class Packages</strong> &#8211; getPackage uses a global lookup table (which is a OOPackage object itself)</li>
<li><strong>Assure Package instead of &#8220;Create Package&#8221;</strong> &#8211; The Assure Package method calles &#8220;assurePackage&#8221; to check the existing Package Chains and assures we do not create multiple instances of parts of the same package chain.</li>
</ol>
<pre></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hotforestgreen.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hotforestgreen.wordpress.com/356/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hotforestgreen.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hotforestgreen.wordpress.com/356/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hotforestgreen.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hotforestgreen.wordpress.com/356/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hotforestgreen.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hotforestgreen.wordpress.com/356/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hotforestgreen.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hotforestgreen.wordpress.com/356/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hotforestgreen.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hotforestgreen.wordpress.com/356/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hotforestgreen.wordpress.com/356/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hotforestgreen.wordpress.com/356/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hotforestgreen.wordpress.com&amp;blog=22795962&amp;post=356&amp;subd=hotforestgreen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hotforestgreen.wordpress.com/2011/07/11/techdoc-oop-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cffc2ff7b980a5f5f76c22bddba4f361?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">peter kaptein</media:title>
		</media:content>
	</item>
		<item>
		<title>TechDoc: Changing the Class Structure for the Auto Discovery Process</title>
		<link>http://hotforestgreen.wordpress.com/2011/07/10/techdoc-changing-the-auto-discovery-process/</link>
		<comments>http://hotforestgreen.wordpress.com/2011/07/10/techdoc-changing-the-auto-discovery-process/#comments</comments>
		<pubDate>Sun, 10 Jul 2011 11:30:34 +0000</pubDate>
		<dc:creator>Peter Kaptein</dc:creator>
				<category><![CDATA[refactoring]]></category>
		<category><![CDATA[techdoc]]></category>

		<guid isPermaLink="false">http://hotforestgreen.wordpress.com/?p=325</guid>
		<description><![CDATA[Introduction HotForestGreen has an auto-detection process running to assure connections to be re-established when they are broken and new Servers to be found for the Data Streams when the old ones collapse, crash or die. Creation and refactoring phases Phase 1: Making it work This first model assumed we wanted to keep a list of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hotforestgreen.wordpress.com&amp;blog=22795962&amp;post=325&amp;subd=hotforestgreen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>HotForestGreen has an auto-detection process running to assure connections to be re-established when they are broken and new Servers to be found for the Data Streams when the old ones collapse, crash or die.</p>
<h2>Creation and refactoring phases</h2>
<h2><strong><em>Phase 1: Making it work</em></strong></h2>
<div id="attachment_326" class="wp-caption alignnone" style="width: 529px"><a href="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sandbox1.png"><img class="size-full wp-image-326" title="HotForestGreen_UML_sandbox1" src="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sandbox1.png?w=519&#038;h=513" alt="" width="519" height="513" /></a><p class="wp-caption-text">Auto Discovery - Phase 1</p></div>
<p>This first model assumed we wanted to keep a list of found &#8220;Hubs&#8221; based on the pings we did within the local network.</p>
<p>As the project progressed, the benefits of Hubs turned out to be minimal, as each time we re-connected or connected a SandBox, we would do a network wide scan anyway.</p>
<p>Also, there were too many steps and too many classes involved, leading to spaghetti code with a lot of entanglements which were close to impossible to understand on first sight.</p>
<h2><strong><em>Phase 2: Cleaning up and cutting out the fluff</em></strong></h2>
<div id="attachment_327" class="wp-caption alignnone" style="width: 541px"><a href="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sandbox2.png"><img class="size-full wp-image-327" title="HotForestGreen_UML_sandbox2" src="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sandbox2.png?w=531&#038;h=477" alt="" width="531" height="477" /></a><p class="wp-caption-text">Phase 2: Cutting out the fluff</p></div>
<p>In the second phase, I removed the Hub and simplified the model to find and recognize a Server.</p>
<p>There is one Class less and the relationship between objects is more clear.</p>
<p>Once a Hub was found, we would immediately ask it for a Server Manifest. Instead of the Server Manifest registering the ServerConnection to a Hub, we simply registered the ServerConnection to the Sandbox.</p>
<p>Instead of using three different type of connections and protocoles, we would only use two:</p>
<ol>
<li><strong>The initial ping</strong> &#8211; Which is the simplest protocol to find a live machine</li>
<li><strong>The ServerConnection</strong> &#8211; Using Messages to receive the Server Manifest, requesting for an IP address and initializing the Server Side SandBox</li>
</ol>
<h2><em><strong>Phase 3: Expanding the connection types</strong></em></h2>
<div id="attachment_328" class="wp-caption alignnone" style="width: 559px"><a href="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sandbox3.png"><img class="size-full wp-image-328" title="HotForestGreen_UML_sandbox3" src="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sandbox3.png?w=549&#038;h=589" alt="" width="549" height="589" /></a><p class="wp-caption-text">Phase 3: Expanding the connection types</p></div>
<p>As we require to support more (including connections to a remote IP address) than just Local Connections and standard Socket Connections (we also want to support Web Sockets and HTTP calls) I started a third phase: adding ConnectionParameters.</p>
<p>From only a Port and scanning the Local Area Network (LAN), it now needed:</p>
<ol>
<li><strong>A port</strong> &#8211; To connect to</li>
<li><strong>An IP Address</strong> &#8211; Being a static constant: IP_LOCALNETWORK  or any IP online.</li>
<li><strong>The Connecton Type</strong> &#8211; Being WebSockets, Normal Sockets, HTTP Connections and anything you can imagine.</li>
</ol>
<h2><em>Explicitly instantiating a specific type of SandBox Connection</em></h2>
<p>I added methods to ConnectionParameters to instantiate the ApplicationSandBox for a specific type of Connection, to reduce coding, to reduce the required knowledge of all involved parameters and combinations you can use and to clarify what options you have when you want to create a SandBox connection.  It also dramatically reduces repetition of actions and the required boilerplate code to create a specific connection.</p>
<h2><em>Introduction of the ServerConnectionManager</em></h2>
<p>As I was unhappy with the role and responsibility of the SandBox in keeping its connections alive I started moving the responsibility to check for connections to a separate Class, called the ServerConnectionManager.</p>
<h2><strong><em>Phase 4: Making it ServerConnection Centric</em></strong></h2>
<div class="mceTemp">
<div id="attachment_332" class="wp-caption alignnone" style="width: 572px"><a href="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sandbox41.png"><img class="size-full wp-image-332" title="HotForestGreen_UML_sandbox4" src="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sandbox41.png?w=562&#038;h=495" alt="" width="562" height="495" /></a><p class="wp-caption-text">Phase 4: Making it ServerConnection Centric</p></div>
</div>
<p>Three things happened due to the addition of more conneection options:</p>
<ol>
<li><strong>Shift of weight away from Application SandBox</strong> &#8211; As the Framework started as a SandBox Centric system, the added options for specific type of connections moved the weight or importance more and more towards the ServerConnection.</li>
<li><strong>Change in the role of Application SandBox</strong> &#8211; The role of the Application SandBox started to shift. As stated before, the code inside the SandBox related to keep the connections alive, started to feel more and more misplaced. Where it once instantiated the connection, it now seemed more logical to have the Connection instantiate the Application SandBox.</li>
<li><strong>Reduction of complexity</strong> &#8211; To maintain the old setup, where the Sandbox carried the responsibility of connecting to Servers and keep those connections alive (by re-wiring when connections got broken) included more and more complex thinking to keep things sane.</li>
</ol>
<p>The solution was to make the Connection the center of the Auto Connection process.</p>
<p>The steps in the new setup are as follows:</p>
<ol>
<li><strong>You define and create a Server Connection</strong> &#8211; Which can run in the Local Area Network, or can point to a specific location.</li>
<li><strong>The Server Connection Object:</strong></li>
<ol>
<li><strong> Instantiates the SandBox</strong> &#8211; Which is stored in a Lookup Table, so if it is already existing, nothing is done and the connection is added</li>
</ol>
<li><strong>You start ServerConnectionManager</strong> &#8211; To start the auto-discovery process. If the process is already running, this request is queed and started when the previous scan is done.</li>
<li><strong>The ServerConnectionManager</strong> &#8211; Is a Singleton object with a heartbeat of 20 seconds. When triggered it will start:</li>
<ol>
<li><strong>The DisposableNodeScanner</strong> &#8211; Which will:</li>
<ol>
<li><strong>Check &#8211; </strong>Existing active  connections per SandBox if we already have a Connection running in that IP range.</li>
<li><strong>Ping</strong> &#8211; When connections are broken to all given IP ranges of Local Networks</li>
<li><strong>Try</strong> &#8211; And establish a Server Connection via the ServerConnection for each responding IP address</li>
</ol>
</ol>
</ol>
<p>By Extending the ServerConnection with the ConnectionParameters we simplify the model and chain of Classes. As each ServerConnection is specifically linked to the Connection Parameters this is a logical step.</p>
<h2><em><strong>Phase 5: Finalizing it</strong></em></h2>
<div id="attachment_337" class="wp-caption alignnone" style="width: 593px"><a href="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sandbox5.png"><img class="size-full wp-image-337" title="HotForestGreen_UML_sandbox5" src="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sandbox5.png?w=583&#038;h=499" alt="" width="583" height="499" /></a><p class="wp-caption-text">Phase 5: Finalizing it</p></div>
<p>To extend the ConnectionParameters did not work out as Local Area Connections can run over multiple IP numbers. Therefore one ConnectionParameters object can relate to multiple ServerConnections.</p>
<p>Enter the SandBoxServerConnector: a general purpose definition object in which we can set the type of connection and use to establish and keep connections to all Sandboxes on all Servers.</p>
<p>What changed from the model in Step 3 and 4 is the following:</p>
<ol>
<li><strong>Sandbox ServerConnector</strong> - Is now the central element and abstracts and shields the actual Server Connections</li>
<ol>
<li><strong>Starts the Server Connection Manager</strong> &#8211; Via an explicit call made at the end of all configurations</li>
<li><strong>Can instantiate the Appication SandBox</strong> &#8211; Through local methods, saving you the work of setting the SandBox name again</li>
</ol>
<li><strong>The Applicaton SandBox</strong> &#8211; Which was hidden by abstraction</li>
<ol>
<li><strong>Has become visible again</strong> &#8211; To use specific methods</li>
<li><strong>Lost its methods to connect to Servers</strong> &#8211; As this has become the full responsibility of the Server Connection Manager</li>
<li><strong>No longer stores references to Connections</strong> &#8211; As this is moved to the objects themselves, following my own rules on refactoring</li>
</ol>
</ol>
<h2><em>Separately initializing the SandBox</em></h2>
<p>To avoid explicit methods for all types of connections and SandBoxes and to avoid the implementation of all kind of exceptions (we have LAN connections and explicit connections. Then &#8211; per connection type &#8211; we can request a dominantly WebSocket type connection or a normal one. Then we can ask for public, trusted and secured SandBoxes) we extract the initialization methods for each specific Sandbox.</p>
<p>It adds one extra line of code to your initialization process, which becomes like this (for a standard Socket Connection in our LAN):</p>
<pre><span style="color:#008000;">// Define the connector</span>
<span style="color:#808080;"><em>SandBoxServerConnector</em></span> <span style="color:#0000ff;">connector</span> =
     <span style="color:#808080;"><em>SandBoxServerConnector</em></span>.<span style="color:#ff0000;">standardSocketInLAN</span>("<span style="color:#0000ff;">sandBox</span>", <span style="color:#0000ff;">821</span>);

<span style="color:#008000;">// Initialize a public sandBox called "sandBox"  </span><span class="Apple-style-span" style="color:#008000;">// on the given port in our connector</span>
<span style="color:#0000ff;">connector</span>.<span style="color:#ff0000;">initializeOpenPublicSandBox</span>(onconnectedHandler, null);

<span style="color:#008000;">// Start the Connecton Manager to create the connections</span>
<span style="color:#808080;"><em>SandBoxServerConnector</em></span>.<span style="color:#ff0000;">startConnectionManager</span>();</pre>
<h2><em>Manual start of the Server Connection Manager</em></h2>
<p>As the Server Connection Manager will do a forced scan of all IP addresses within the range of your LAN connection, we want to reduce the overhead as much as possible.</p>
<p>Initially the scan would be performed automatically on registration of a SandBox.</p>
<p>The disadvantage of this is clear: when you register multiple SandBoxes, multiple scans will be performed, unless some extra mechanism is added to the scanning process &#8211; leading to a lot of added complexity and never being completely fail safe.</p>
<p>Instead we use the most simple of solutions:</p>
<p>When you are done creating and registering your SandBoxes, you start the discovery process of the Server Connection Manager.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hotforestgreen.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hotforestgreen.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hotforestgreen.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hotforestgreen.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hotforestgreen.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hotforestgreen.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hotforestgreen.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hotforestgreen.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hotforestgreen.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hotforestgreen.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hotforestgreen.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hotforestgreen.wordpress.com/325/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hotforestgreen.wordpress.com/325/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hotforestgreen.wordpress.com/325/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hotforestgreen.wordpress.com&amp;blog=22795962&amp;post=325&amp;subd=hotforestgreen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hotforestgreen.wordpress.com/2011/07/10/techdoc-changing-the-auto-discovery-process/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cffc2ff7b980a5f5f76c22bddba4f361?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">peter kaptein</media:title>
		</media:content>

		<media:content url="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sandbox1.png" medium="image">
			<media:title type="html">HotForestGreen_UML_sandbox1</media:title>
		</media:content>

		<media:content url="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sandbox2.png" medium="image">
			<media:title type="html">HotForestGreen_UML_sandbox2</media:title>
		</media:content>

		<media:content url="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sandbox3.png" medium="image">
			<media:title type="html">HotForestGreen_UML_sandbox3</media:title>
		</media:content>

		<media:content url="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sandbox41.png" medium="image">
			<media:title type="html">HotForestGreen_UML_sandbox4</media:title>
		</media:content>

		<media:content url="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sandbox5.png" medium="image">
			<media:title type="html">HotForestGreen_UML_sandbox5</media:title>
		</media:content>
	</item>
		<item>
		<title>TechDoc: Moving towards multi-purpose Socket Servers</title>
		<link>http://hotforestgreen.wordpress.com/2011/07/10/techdoc-moving-towards-multi-purpose-socket-servers/</link>
		<comments>http://hotforestgreen.wordpress.com/2011/07/10/techdoc-moving-towards-multi-purpose-socket-servers/#comments</comments>
		<pubDate>Sun, 10 Jul 2011 10:06:01 +0000</pubDate>
		<dc:creator>Peter Kaptein</dc:creator>
				<category><![CDATA[techdoc]]></category>

		<guid isPermaLink="false">http://hotforestgreen.wordpress.com/?p=318</guid>
		<description><![CDATA[Introduction The HotForestGreen base design started with Standard type Sockets. As support of as many different platforms (HTML, Flash, Java, Android, Windows, Mac, Linux) as possible is a requirement WebSockets were on the list for a long time. I started implementing them in the past days: the first week of July, 2011. Based on some [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hotforestgreen.wordpress.com&amp;blog=22795962&amp;post=318&amp;subd=hotforestgreen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>The HotForestGreen base design started with Standard type Sockets. As support of as many different platforms (HTML, Flash, Java, Android, Windows, Mac, Linux) as possible is a requirement WebSockets were on the list for a long time.</p>
<p>I started implementing them in the past days: the first week of July, 2011.</p>
<p>Based on some online sources like the <a href="http://jwebsocket.org/mobile/android/android_part1.htm">jWebsocket </a>article and the code in the <a href="http://www.sencha.com/forum/showthread.php?99842-WebSocket-server-in-C">WebSockets </a>server by Bert Mortheamer  I was able to build a specific handler.</p>
<h2>Multi-purpose server</h2>
<p>As Sockets are the base objects for all communication, and protocols are what are added, I moved away from Protocol Specific Servers: which was the second incarnation of my code after refactoring.</p>
<h2>Mutation of Class Structure</h2>
<p>Below you will find the mutation of the Class Structure to support the new directions. Each phase took at least one refactoring, breaking the entire project until it was fully implemented.</p>
<h2><em>Original setup</em></h2>
<p>As we only had one type of Socket, the structure was simple.</p>
<div id="attachment_319" class="wp-caption alignnone" style="width: 348px"><a href="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sockets1.png"><img class="size-full wp-image-319" title="HotForestGreen_UML_sockets1" src="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sockets1.png?w=338&#038;h=386" alt="" width="338" height="386" /></a><p class="wp-caption-text">Original Class Structure to handle Client Sockets</p></div>
<h2><em>WebSockets are not the same as Standard Sockets</em></h2>
<p>Web Sockets implement a different protocol and a specific handshake, based on HTPP. This means that we need to extend the Standard Socket and also have to find a way to direct the incoming Socket to the correct handler.</p>
<h2><em>Strategy &#8211; Introducing different type of Sockets</em></h2>
<p>So we need to choose which we will use. In the Class Structure as shown below, the main assumption was that we would tell the Server what kind of Sockets it would support. Based on that it would choose the Socket Type from a Lookup Table and instantiate that specific Socket Type to deal with the incoming data and Socket Type related protocols.</p>
<div id="attachment_320" class="wp-caption alignnone" style="width: 573px"><a href="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sockets3.png"><img class="size-full wp-image-320" title="HotForestGreen_UML_sockets3" src="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sockets3.png?w=563&#038;h=519" alt="" width="563" height="519" /></a><p class="wp-caption-text">Second implementation: Strategy to chosse specific Socket Type</p></div>
<h2>Socket Handlers &#8211; Making the model more flexible</h2>
<p>What I did not like about the second model, implemented on a Saturday, was the rigid nature. Each SocketServer would only serve a specific type of Sockets, making mixing of Socket Types harder to do.</p>
<p>After starting the implementation of a specific connection of type: Bi-Directional Gateway, I decided to do a third refactoring: moving towards Socket Handlers instead of Socket Types.</p>
<div id="attachment_321" class="wp-caption alignnone" style="width: 573px"><a href="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sockets31.png"><img class="size-full wp-image-321" title="HotForestGreen_UML_sockets3" src="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sockets31.png?w=563&#038;h=519" alt="" width="563" height="519" /></a><p class="wp-caption-text">Using Socket Handlers instead of Socket Types</p></div>
<p>The difference is how the Socket Encapsulation is done.</p>
<ol>
<li><strong>Socket Types: decision before reading the content</strong> &#8211; With Socket Types, I have to decide beforehand which Class I instantiate. Only then I will start the process of receiving data.</li>
<li><strong>Socket Handlers: first read content, then decide how to handle it</strong> &#8211; With the Socket Handlers, I first start receiving data (the Header) and based on what I find inside that Header, I will instantiate a Handler which will deal with Socket Type Specific protocols.</li>
</ol>
<h2>Encapsulation and the ISocket Interface</h2>
<p>To serve specific Socket Types, we need to cater specific communication protocols. The protocol to encapsulate data, as used in the Standard Type Socket is different form a Web Socket. Still, the basic activities we want to perform remain the same.</p>
<p>These actions are:</p>
<ol>
<li><strong>Send and receive Messages</strong> &#8211; Which are (should be) always formatted the same way, containing a header for the Server and a message Body to be processed by the receiving Client.</li>
<li><strong>Check if the Socket is still connected</strong> &#8211; Of which the method might vary per Socket Type, but the outcome is always the same: &#8220;yes&#8221; or &#8220;no&#8221;</li>
<li><strong>Start and stop the Socket</strong> &#8211; Including its disconnection</li>
<li><strong>Auto-connect the Socket when connection is broken</strong> &#8211; Done via the Socket Handler</li>
</ol>
<h2>Benefits and results &#8211; simpler model, more options</h2>
<ol>
<li><strong>It does not matter anymore what Type of  Socket is connecting</strong> &#8211;  WebSocket, HTML http request, Standard Socket, your own protocol: if we recognize it, we will assign a specific Handler to it to deal with</li>
<li><strong>Any Type of Socket can communicate data to any other Type of Socket</strong> &#8211; As long as they are in the same Scope, defined by the Port and SandBox</li>
<li><strong>The Class Structure stays simple while options grow</strong> - Very important. There is not just one way to do things and not just one technology to get it done.</li>
<li><strong>It is easier to expand the model with new (your own) Socket Types</strong> &#8211; Using injection. See: &#8220;Creating and adding new Socket Types&#8221;</li>
</ol>
<h2>Creating and adding new Socket Types</h2>
<p>Using the ISocket interface, you can add any Type of Socket to the collection of existing Sockets.</p>
<p>What you need is the following:</p>
<ol>
<li><strong>A Socket Type Identifier</strong> &#8211; This is for internal use.</li>
<li><strong>The implementation of ISocket</strong> &#8211; As the Socket Handler expects a specific standardized Interface, it will expect you to implement and use that specific contract.</li>
<li><strong>A Header Validator</strong> &#8211; Which is a public method in your Class. The Header Validator is used by the Socket Handler to verify if the Header is specific to a Socket Type.</li>
</ol>
<h2><em>Socket Type Auto Detection</em></h2>
<p>For each Socket Connection, the header will be verified against the different Socket Type Handlers, using a public method.</p>
<p>If the validation process returns a &#8220;true&#8221; then that Socket Type Handler is the one to be used.</p>
<h2><em>Allowing fox mixed Socket Types on one single port</em></h2>
<p>Instead of separating Socket Types per port (as is usual for HTPP, FTP and Socket type connections) we want to allow any Socket Type to be able to connect. In the end they all are Base Sockets and in the end they all connect because they need the data flowing within one or more Application Clusters.</p>
<p>These are the reasons:</p>
<ol>
<li><strong>The method is less important than the purpose</strong> &#8211; The purpose is to exchange data between Clients. As these Clients can include HTML pages with Web Sockets, and more standard protocols might be added, we should accept any protocol IF we can recognize it.</li>
</ol>
<h2>Plug and Play &#8211; Extending the model with a HTPP handler</h2>
<p>Now that we have a Plug and Play type of model, where we inject Handlers into the Framework, we can start expanding it. One of the next modules is to handle standard HTTP requests.</p>
<p>This allows for the Servers to offer a web page and web site, allowing for a very simple low-effort way to build Remote Controls for public use.</p>
<h2><em>Web Based Remote Controls</em></h2>
<p>Web Based Remote Controls are small web sites, offering you the tools to communicate with an Application Cluster using a simple Web Browser.</p>
<p>The standards I am thinking of using for Web Based Remote Controls are those:</p>
<ol>
<li><strong>HTML</strong> &#8211; Allowing for a broader support and the lack of need for a specific plugin or compiler (Flash, Java). Might not work on all browsers. Specifically when WebSockets are used but not supported.</li>
<ol>
<li><strong>WebSockets</strong> &#8211; For real time interactions via JavaScript</li>
<li><strong>HTTP calls</strong> &#8211; When your browser does not allow for more complex stuff including Web Sockets. This will be implemented in the second phase of the Simple Web Browser Implementation in the Framework.</li>
<li><strong>Intercepted calls in a custom browser</strong> &#8211; When you can deploy a application for general use which includes a Web Browser that intercepts calls of specific types, like: &#8220;socketcall:&lt;your call to the HotForestGreen Application Cluster&gt;&#8221;</li>
</ol>
<li><strong>Flash</strong> &#8211; allowing for a more stable platform and browser independent implementation. Might not run on all systems (old Android phones, specific tablets, Mac iOS)</li>
<ol>
<li><strong>Normal Sockets</strong> &#8211; As supported by flash</li>
<li><strong>Web Sockets</strong> &#8211; When normal Sockets are blocked due to their (lack of) protocol</li>
</ol>
</ol>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hotforestgreen.wordpress.com/318/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hotforestgreen.wordpress.com/318/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hotforestgreen.wordpress.com/318/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hotforestgreen.wordpress.com/318/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hotforestgreen.wordpress.com/318/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hotforestgreen.wordpress.com/318/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hotforestgreen.wordpress.com/318/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hotforestgreen.wordpress.com/318/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hotforestgreen.wordpress.com/318/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hotforestgreen.wordpress.com/318/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hotforestgreen.wordpress.com/318/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hotforestgreen.wordpress.com/318/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hotforestgreen.wordpress.com/318/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hotforestgreen.wordpress.com/318/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hotforestgreen.wordpress.com&amp;blog=22795962&amp;post=318&amp;subd=hotforestgreen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hotforestgreen.wordpress.com/2011/07/10/techdoc-moving-towards-multi-purpose-socket-servers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cffc2ff7b980a5f5f76c22bddba4f361?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">peter kaptein</media:title>
		</media:content>

		<media:content url="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sockets1.png" medium="image">
			<media:title type="html">HotForestGreen_UML_sockets1</media:title>
		</media:content>

		<media:content url="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sockets3.png" medium="image">
			<media:title type="html">HotForestGreen_UML_sockets3</media:title>
		</media:content>

		<media:content url="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_uml_sockets31.png" medium="image">
			<media:title type="html">HotForestGreen_UML_sockets3</media:title>
		</media:content>
	</item>
		<item>
		<title>TechDoc: Different types of Socket connections</title>
		<link>http://hotforestgreen.wordpress.com/2011/07/09/techdoc-different-types-of-socket-connections/</link>
		<comments>http://hotforestgreen.wordpress.com/2011/07/09/techdoc-different-types-of-socket-connections/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 19:43:23 +0000</pubDate>
		<dc:creator>Peter Kaptein</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hotforestgreen.wordpress.com/?p=312</guid>
		<description><![CDATA[Basis HotForestGreen uses a specific set of Socket connections with specific qualities for specific purposes. Overview WebSockets &#8211; For HTML Clients. Read more about them in: &#8220;Web Sockets and Web Clients&#8220;. Requires a specifif IP Address - To connect to a HotForestGreen Server, the WebSocket needs to connect to a Known Server on a Known Web Address [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hotforestgreen.wordpress.com&amp;blog=22795962&amp;post=312&amp;subd=hotforestgreen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Basis</h2>
<p>HotForestGreen uses a specific set of Socket connections with specific qualities for specific purposes.</p>
<h2>Overview</h2>
<ol>
<li><strong>WebSockets</strong> &#8211; For HTML Clients. Read more about them in: &#8220;<a title="TechDoc: WebSockets and Web Clients" href="http://hotforestgreen.wordpress.com/2011/07/09/techdoc-websockets-and-web-clients/">Web Sockets and Web Clients</a>&#8220;.</li>
<ol>
<li><strong>Requires a specifif IP Address </strong>- To connect to a HotForestGreen Server, the WebSocket needs to connect to a Known Server on a Known Web Address</li>
<li><strong>Are not binary</strong> &#8211; Even though WebSockets can support binary data, this is currently not supported by the HotForestGreen Server</li>
<li><strong>Streams per data package</strong> &#8211; Each data package or Message is streamed. Each Message is held Server Side until all data is in and parsed only then to all observers. this will create a minimal latency, based on package size and transfer speed.</li>
<li><strong>Uses an event based model</strong> &#8211; Each message sent is comparable with an Event.</li>
</ol>
<li><strong>StandardSockets</strong> &#8211; As the name suggests, these are your run of the mill Sockets without any extra protocol</li>
<ol>
<li><strong>Requires a specific IP Address</strong> &#8211; If you want to connect to a location online</li>
<li><strong>Allows for AutoConnect</strong> &#8211; Inside a local network: by scanning all local IP addresses for the existence of one or more HotForestGreen Socket Servers</li>
<li><strong>Are not binary</strong> - Even though standard Sockets can support binary data, this is currently not supported by the HotForestGreen Server</li>
<li><strong>Streams per data package</strong> - Each data package or Message is streamed. Each Message is held Server Side until all data is in and parsed only then to all observers. This will create a minimal latency, based on package size and transfer speed.</li>
<li><strong>Uses an event based model</strong> - Each message sent is comparable with an Event.</li>
</ol>
<li><strong>StreamSockets</strong> &#8211; These Sockets are optimized to stream continuous data.</li>
<ol>
<li><strong>Requires a specific IP Address</strong> - If you want to connect to a location online</li>
<li><strong>Allows for AutoConnect</strong> - Inside a local network: by scanning all local IP addresses for the existence of one or more HotForestGreen Socket Servers</li>
<li><strong>Is binary</strong> &#8211; To allow for binary streams</li>
<li><strong>Streams </strong><strong>continuously</strong> - Each set of N bytes is immediately streamed to all observers, allowing for minimal latency</li>
<li><strong>Not implemented yet</strong> &#8211; Streaming Sockets are not implemented yet.</li>
</ol>
</ol>
<h2>See also</h2>
<div>
<ol>
<li><strong>The HotForestGreen AutoConnect mechanism</strong> &#8211; In: &#8220;<a title="TechDoc: The Automated HotForestGreen Server Discovery Process in 3 steps" href="http://hotforestgreen.wordpress.com/2011/07/06/techdoc-the-automated-server-discovery-process-in-3-steps/">The Automated HotForestGreen Server Discovery mechanism</a>&#8220;.</li>
<li><strong>Data Serialization and de-serialization</strong> &#8211; in &#8220;<a title="TechDoc: Using comma separated values instead of JSON or XML for efficient data transfer" href="http://hotforestgreen.wordpress.com/2011/05/24/techdoc-using-comma-separated-values-for-data-transfer/">Using Comma Separated Value for efficient data transfer</a>&#8220;</li>
</ol>
</div>
<h2>Why is binary data not the standard?</h2>
<p>HotForestGreen uses a very simple protocol, designed to work on most, if not all, platforms including Android, HTML, Flash, Java and C#.</p>
<p>The packages sent contain clear text data for the following reasons:</p>
<ol>
<li><strong>Simplicity of design</strong> &#8211; Regardless of your platform, you can read and handle Socket Data that is clear text. Handling binary data can become very complex.</li>
<ol>
<li><strong>Clear text format</strong> - Most data handled in systems are Strings and Numbers.</li>
<li><strong>ASCII Separators</strong> &#8211; To define the start and stop of the headers and the data sent within a package, ASCII separators are used to mark:</li>
<ol>
<li><strong>&lt;02&gt; Start of text</strong> &#8211; Indicates where the Message Body starts</li>
<li><strong>&lt;04&gt; End of Transmission</strong> &#8211; To signal where the block of data ends.</li>
<li><strong>&lt;30&gt; Record separator</strong> &#8211; To state where a data row or record ends and a new one starts (see the next item: &#8220;Serialization and de-serialization of data&#8221;)</li>
<li><strong>&lt;31&gt; Unit Separator</strong> &#8211; To separate values and fields within a data row or record</li>
</ol>
<li><strong>Serialization and de-serialization of data</strong> &#8211; Data is serialized and de-serialized using Lists (Arrays), ASCII based separators (see previous item) and operations on Lists (and Arrays) to Split and Join this data. This allows for very short and relatively fast code.</li>
</ol>
</ol>
<h2>Everything is binary, no?</h2>
<p>Everything we send via Sockets is binary data, with values from 0&#215;00 to 0xFF. So far so good.</p>
<h2><em>Reserved codes</em></h2>
<p>But like WebSockets, some binary codes are reserved for specific use.</p>
<p>Sending truly binary data, like sound files or images, could lead to accidental occurrences of specific codes we use to separate data.</p>
<h2><em>Fast serialization and de-serialization</em></h2>
<p>In our case to separate data and allow for fast and simple Serialization and De-serialization.</p>
<h2><em>Holding state</em></h2>
<p>Currently, all packages sent to a Server are put in a &#8220;Holding state&#8221; until all data is in. Then they are distributed to all registered observers.</p>
<h2><em>Socket for streaming data </em></h2>
<p>As binary data can be large (think files and images) or continuous (think audio and video streams) the best solution might be to have a Socket specifically for streaming data.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hotforestgreen.wordpress.com/312/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hotforestgreen.wordpress.com/312/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hotforestgreen.wordpress.com/312/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hotforestgreen.wordpress.com/312/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hotforestgreen.wordpress.com/312/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hotforestgreen.wordpress.com/312/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hotforestgreen.wordpress.com/312/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hotforestgreen.wordpress.com/312/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hotforestgreen.wordpress.com/312/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hotforestgreen.wordpress.com/312/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hotforestgreen.wordpress.com/312/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hotforestgreen.wordpress.com/312/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hotforestgreen.wordpress.com/312/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hotforestgreen.wordpress.com/312/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hotforestgreen.wordpress.com&amp;blog=22795962&amp;post=312&amp;subd=hotforestgreen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hotforestgreen.wordpress.com/2011/07/09/techdoc-different-types-of-socket-connections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cffc2ff7b980a5f5f76c22bddba4f361?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">peter kaptein</media:title>
		</media:content>
	</item>
		<item>
		<title>TechDoc: WebSockets and HTML based Web Clients</title>
		<link>http://hotforestgreen.wordpress.com/2011/07/09/techdoc-websockets-and-web-clients/</link>
		<comments>http://hotforestgreen.wordpress.com/2011/07/09/techdoc-websockets-and-web-clients/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 18:56:30 +0000</pubDate>
		<dc:creator>Peter Kaptein</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hotforestgreen.wordpress.com/?p=310</guid>
		<description><![CDATA[Introduction There is more to HotForestGreen than Java, Flash and C#. As I started working on the (new) road map for this Framework in 2010, Web Sockets (and a simple integrated HTTP Web Server) became a very important part of it. Why WebSockets? There are several reasons for the implementation of Web Sockets: Allow for communication where [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hotforestgreen.wordpress.com&amp;blog=22795962&amp;post=310&amp;subd=hotforestgreen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>There is more to HotForestGreen than Java, Flash and C#.</p>
<p>As I started working on the (new) road map for this Framework in 2010, Web Sockets (and a simple integrated HTTP Web Server) became a very important part of it.</p>
<h2>Why WebSockets?</h2>
<div id="attachment_352" class="wp-caption alignnone" style="width: 604px"><a href="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_websockets1.png"><img class="size-full wp-image-352" title="HotForestGreen_WebSockets1" src="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_websockets1.png?w=594&#038;h=283" alt="" width="594" height="283" /></a><p class="wp-caption-text">Web Sockets in a Web Client, connected to a Server</p></div>
<p>There are several reasons for the implementation of Web Sockets:</p>
<ol>
<li><strong>Allow for communication where Low Level Sockets might not be</strong> - In some environments, anything that is not a specific Socket with a specific protocol (in most cases: &#8220;is not HTTP&#8221;) is blocked.</li>
<li><strong>HTML-based Web Clients</strong> &#8211; Which can be build by anyone with a text editor and allows for quick development and a very low point of entry for anyone who wants to start playing with HotForestGreen.</li>
<li><strong>No compiler needed</strong> &#8211; As they run in JavaScript inside HTML pages inside a browser, the only thing you need is a browser that supports Web Sockets</li>
<li><strong>Can be used by anyone</strong> &#8211; With a basic knowledge of HTML and JavaScript</li>
<li><strong>Allow for a simple distribution model: the web</strong> &#8211; With any non-web based standard, your application needs to be downloaded and installed to work. Wwith Web Sockets, the only thing your users have to do is connect to the right location, with a browser that supports Web Sockets</li>
</ol>
<h2>HTML based Web Clients</h2>
<p>Web Clients can be of any type including: Flash, Java and HTML.</p>
<p>HTML based Web Clients are applications that run (in most cases) in a Web Browser, communicate to a Server and use HTML (and JavaScript) to process and present data and interact with the user and the Server.</p>
<h2>Useful links on WebSockets</h2>
<ol>
<li><strong>jWebsocket for Android</strong> &#8211; <a href="http://jwebsocket.org/mobile/android/android_part1.htm">This article</a> by Predrag Stojadinovic describes how the WebSoeckets and handshakes are set up</li>
</ol>
<h2>The ABC of a WebSocket</h2>
<p>Let&#8217;s assume we have a web socket connection like this:</p>
<pre>var host = "ws://<span style="color:#0000ff;">localhost:80</span>/<span style="color:#ff0000;">mySandBox</span>?<span style="color:#0000ff;">myVar1=1&amp;myVar2=2</span>";
var ws = new WebSocket(host);</pre>
<h2><em>Header</em></h2>
<p>A WebSocket Header will be sent on connect and can contain the following base data, separated by a LF or CR/LF.</p>
<p>The header as received on the Server can look like this:</p>
<p><span style="color:#008000;">GET /test?x=1&amp;y=2 HTTP/1.1\r\nUpgrade: WebSocket\r\nConnection: Upgrade\r\nHost: localhost:821\r\nOrigin: null\r\nSec-WebSocket-Protocol: someprotocol\r\nSec-WebSocket-Key1: &amp;q 19 6 54 c6 C&amp; &amp; 533 &lt;a7 (\r\nSec-WebSocket-Key2: 27W 72 00 0&#215;5 94\r\n\r\n����J��g&#8221; object {string}</span></p>
<p>When we replace the \r\n for enters we get this:</p>
<pre>GET /mySandBox?myVar1=1&amp;myVar2=2 HTTP/1.1
Upgrade: WebSocket
Connection: Upgrade
Host: localhost:821
Origin: null
Sec-WebSocket-Protocol: null
Sec-WebSocket-Key1: &amp;q 19 6 54 c6 C&amp; &amp; 533  &lt;a7  (\r\nSec-WebSocket-Key2: 27W  72  00 0x5 94
\r\n\r\n&lt;8 byte long binary data for key 3&gt;</pre>
<h2><em>Connecting to a SandBox</em></h2>
<p>If you look at the red part of the URL, you will see the sandbox name:</p>
<pre>"ws://<span style="color:#0000ff;">localhost:80</span>/<span style="color:#ff0000;">mySandBox</span>?myVar1=1&amp;myVar2=2";</pre>
<p>The requested SandBox is passed to the Server as if it is a folder on that Server.</p>
<h2><em>Web Socket Server Response</em></h2>
<p>The Server Response we send back is mostly an echo from what we received, shuffled around.</p>
<p>For protocol V76 we add the secret keys and a check sum in our response, which is based on the three keys we sent.</p>
<pre>HTTP/1.1 101 WebSocket Protocol Handshake
Upgrade: WebSocket
Connection: Upgrade
Sec-WebSocket-Origin: http://null
Sec-WebSocket-Location: ws://localhost:821/mySandBox

8jKS'y:G*Co,Wxa-</pre>
<h2><em>WebSocket Header Parts</em></h2>
<p>Below is a full overview of the header, with a short overview of each part. As we only use a very small sub set of the call we receive (marked in red), all parts we do not use for the framework will be marked grey. The parts vital for the returning hand-shake are marked green. Other parameters used in the return set to the browser include our red ones and the ones marked blue.</p>
<ol>
<li><span style="color:#808080;"><strong>GET/POST</strong></span> &#8211; The beginning string of our header reflecting the way the data is sent</li>
<ol>
<li><span style="color:#ff0000;"><strong>URI</strong></span> &#8211; The part right after our base connection information. In our example this is: &#8220;/mySandBox?myVar1=1&amp;myVar2=2&#8243;</li>
<li><span style="color:#008000;"><strong>HTTP version</strong></span> &#8211; The verison of the HTTP client/call. Unused</li>
</ol>
<li><span style="color:#ff0000;"><strong>Upgrade: WebSocket</strong></span> &#8211; The type of connection. We use this as the identifier for the Type of Socket Handler</li>
<li><span style="color:#808080;"><strong>Connection: Upgrade</strong></span> - The type of connection as defined in Upgrade</li>
<li><span style="color:#0000ff;"><strong>Host: localhost:80</strong></span> &#8211; Our IP and port number to which we connected. As we already known this from our Socket Connection, we do not need this.</li>
<li><span style="color:#0000ff;"><strong>Origin: null</strong></span> &#8211; Unknown purpose. Might contain the IP of the caller</li>
<li><span style="color:#808080;"><strong>Sec-WebSocket-Protocol: &lt;your definition&gt;</strong></span> &#8211; Contains the protocol as you set it in the second variable when you create a WebSocket. Unused for HotForestGreen</li>
<li><span style="color:#008000;"><strong>Sec-WebSocket-Key1: &lt;a key value&gt;</strong></span> &#8211; Contains the first web socket key from the client</li>
<li><span style="color:#008000;"><strong>Sec-WebSocket-Key2: &lt;a key value&gt;</strong></span> - Contains the second web socket key from the client</li>
<li><span style="color:#008000;"><strong>8 byte binary data for key 3 </strong></span>- Contains the 3rd key, to be read as binary</li>
</ol>
<h2><em>Everything is binary data over a Standard Socket</em></h2>
<p>When you dive into Web Sockets and how a Web Socket Server is created, at the end of the ride you will find a standard issue Data Socket.</p>
<p>Even the data itself is standard data sent as a binary stream over a binary connection</p>
<p>What differs from a &#8220;normal&#8221; socket is the following:</p>
<ol>
<li><strong>The header</strong> &#8211; With each connection attempt from a Client to a Server, the Client sends a HTTP WebSocket header with specific data to establish a hand schake</li>
<li><strong>The hand shake</strong> &#8211; The Client expects a specific reply from the Server, to establish a low level type of trust: that it is connected to a Web Socket Server</li>
<li><strong>Information about packages and (in case of binary data) package size</strong> &#8211; For Web Sockets, these are mainly used for binary data</li>
<li><strong>Start and End Bytes</strong> &#8211; Each data package we send to a Server or Client starts with a Start byte (&lt;0&#215;00&gt;) and ends with an End byte (&lt;0xFF&gt;)</li>
</ol>
<div>Everything happening in between can be &#8211; in principle &#8211; completely binary, using &#8211; in most cases &#8211; 8 bit bytes.</div>
<h2><em>Everything is Clear Text data with specific separators</em></h2>
<p>HotForestGreen works primarily with Clear Text Data, separated into specific blocks using specific ASCII codes.</p>
<p>The main reason is to keep things open and simple when we translate and de-serialize the incoming packages.</p>
<h2><em>If you need to send binary data&#8230;</em></h2>
<p>Where binary data is required, we send two packages:</p>
<ol>
<li><strong>Header package</strong> &#8211; A header package indicating the Server to expect a binary stream of a specific length</li>
<li><strong>Binary stream</strong> &#8211; The binary stream itself.</li>
</ol>
<div>Right now (July 2011) the implementation for binary data is completely rudimentary and does not work. There is no priority yet to implement this.</div>
<h2><em>WebSocket Start and end bytes</em></h2>
<p>Each WebSocket data package is wrapped in a Start and End Byte. Like this: &#8220;&lt;<span style="color:#ff0000;">StartByte</span>&gt;My Socket Message&lt;<span style="color:#0000ff;">EndByte</span>&gt;&#8221;.</p>
<p>More concrete, these bytes are: &#8221;&lt;<span style="color:#ff0000;">0&#215;00</span>&gt;My message&lt;<span style="color:#0000ff;">0xFF</span>&gt;&#8221;.</p>
<h2>Network Streams and WebSocket Messages</h2>
<p>A WebSocket Client requres an HTTP complient protocol to send Socket Data to thee client.</p>
<p>For this we use a (C#) NetworkStream instead of a bare Socket.</p>
<p>These streams state their lenght in the first parts of the data stream and as such have a slightly different build up from a generic Socket Connection which basically just streams data when there is data to stream and has no terminator at the <strong>end</strong> of the stream &#8211; except for 0&#215;00 values as there is no data in the buffer used to inject the Socket Data in &#8211; when done writing.</p>
<h2>Limited implementation for Web Sockets</h2>
<p>WebSockets only have a limited implementation due to their character of running in an open space and using JavaScript code exposed and retrievable as clear text.</p>
<ol>
<li><strong>No auto connect</strong> &#8211; You need to specify the IP Address to which you want to connect via a Web socket</li>
<li><strong>No Trusted or Secured Sandboxes</strong> &#8211; As these require a shared key on Client and Server and as HTML is uncompiled clear text, we rather not.</li>
<li><strong>No binary data</strong> &#8211; As stated before, this is not a priority yet, as we have no use cases yet where Web Clients need to send binary data to an Application Cluster</li>
</ol>
<h2><em>No auto connect</em></h2>
<p>The auto detection process as used on the C# and Java Clients runs in several threads, to allow for parallel scans over multiple ports. If done in a sequential order, the process might take several seconds to complete.</p>
<p>Short and simple: I wanted to keep things simple and avoided this for Web Sockets</p>
<h2><em>Scope of Web Sockets</em></h2>
<p>WebSocket Clients are designed for use in:</p>
<ol>
<li><strong>HTML clients</strong> &#8211; To allow for simple and fast designs and simple distribution of applications using the Real Time Interaction models of HotForestGreen over the web</li>
<li><strong>C#, Flash and Java clients</strong> &#8211; To connect to Web Socket based Application Access Points</li>
<li><strong>Public Sandboxes</strong> &#8211; Which do not require a secret hand shake and accept any client trying to connect</li>
</ol>
<h2>Public SandBoxes &#8211; and what they are</h2>
<p>There are three types of SandBoxes:</p>
<ol>
<li><strong>Public SandBoxes</strong> &#8211; Allowing anyone to connect, if their header and stated protocol is recognized</li>
<li><strong>Public Trusted SandBoxes</strong> &#8211; Allowing only Trusted Clients to connect: using a secret handshake with passwords both Trusted Client and Trusted Server know. If either of them fails to give the proper response, no Trust can be established and the connection is broken.</li>
<li><strong>Secured SandBoxes</strong> &#8211; These are SandBoxes hidden under a specific key and secured via a Trust Relationship. For instance: the secured Sandbox: &#8220;mySecuredSandBox&#8221; with key: &#8220;my secret key&#8221; will be hidden under &#8220;my secret key::mySecuredSandBox&#8221;. This makes scanning and attempting to connect to Secured SandBoxes a bit harder.</li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hotforestgreen.wordpress.com/310/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hotforestgreen.wordpress.com/310/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hotforestgreen.wordpress.com/310/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hotforestgreen.wordpress.com/310/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hotforestgreen.wordpress.com/310/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hotforestgreen.wordpress.com/310/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hotforestgreen.wordpress.com/310/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hotforestgreen.wordpress.com/310/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hotforestgreen.wordpress.com/310/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hotforestgreen.wordpress.com/310/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hotforestgreen.wordpress.com/310/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hotforestgreen.wordpress.com/310/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hotforestgreen.wordpress.com/310/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hotforestgreen.wordpress.com/310/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hotforestgreen.wordpress.com&amp;blog=22795962&amp;post=310&amp;subd=hotforestgreen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hotforestgreen.wordpress.com/2011/07/09/techdoc-websockets-and-web-clients/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cffc2ff7b980a5f5f76c22bddba4f361?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">peter kaptein</media:title>
		</media:content>

		<media:content url="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_websockets1.png" medium="image">
			<media:title type="html">HotForestGreen_WebSockets1</media:title>
		</media:content>
	</item>
		<item>
		<title>TechDoc: The Automated HotForestGreen Server Discovery Process in 3 steps</title>
		<link>http://hotforestgreen.wordpress.com/2011/07/06/techdoc-the-automated-server-discovery-process-in-3-steps/</link>
		<comments>http://hotforestgreen.wordpress.com/2011/07/06/techdoc-the-automated-server-discovery-process-in-3-steps/#comments</comments>
		<pubDate>Wed, 06 Jul 2011 14:10:07 +0000</pubDate>
		<dc:creator>Peter Kaptein</dc:creator>
				<category><![CDATA[techdoc]]></category>

		<guid isPermaLink="false">http://hotforestgreen.wordpress.com/?p=271</guid>
		<description><![CDATA[Basics of auto-detection Any basic HotForestGreen Client does auto-detection when &#8220;switched on&#8221;. This Auto Detection scans the local network the Client is connected to (via the device it runs on and the network that device is connected to). It will automatically connect to an Application Cluster once it: Has found one or more Servers. Is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hotforestgreen.wordpress.com&amp;blog=22795962&amp;post=271&amp;subd=hotforestgreen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Basics of auto-detection</h2>
<p>Any basic HotForestGreen Client does auto-detection when &#8220;switched on&#8221;. This Auto Detection scans the local network the Client is connected to (via the device it runs on and the network that device is connected to).</p>
<p>It will automatically connect to an Application Cluster once it:</p>
<ol>
<li>Has found one or more Servers.</li>
<li>Is allowed to join.</li>
</ol>
<h2>Images</h2>
<p>Below you will find four images with some extra explanations visualizing the process and the full implementation.</p>
<h2>Purpose</h2>
<p>The purpose of the Automated Process is to:</p>
<ol>
<li><strong>Plug and Play</strong> &#8211; Instead of you having to do a lot of configuration on Networks and IP Addresses, the Framework will take care of that. Allowing you to focus your energy on what is relevant for you.</li>
<li><strong>Simplify building Distributed Applications</strong> - To make building Distributed Applications, running over multiple machines, and within one or more Application Clusters, containing it all, as easy as cake.</li>
<li><strong>Simplify connecting to Distributed Applications</strong> - To allow you to build (Stray) Clients to your Distributed Applications and work with whatever goes on inside.</li>
<li><strong>Allow for fail safe- and fallback scenarios</strong> - By allowing you to add any number of Servers within your Local Network and do automated Load Balancing and automated Re-routing of communication streams when Servers drop out / crash</li>
</ol>
<h2>Targets</h2>
<p>The targets for auto-connection are:</p>
<ol>
<li><strong>Servers and Server Clusters</strong> &#8211; Finding each other and communicating work load and number of connections</li>
<li><strong>Trusted Clients</strong> &#8211; Running inside the network and the Application Cluster and being known</li>
<li><strong>Stray Clients</strong> &#8211; Like mobile phones and tablets hooking into the Network and coming from anywhere</li>
</ol>
<h2>Scope: Local Network</h2>
<div>This article covers the auto-discovery process within a local network.</div>
<div>
<h2>Connecting to specific IP addresses online</h2>
<div>This post only covers the Local Network. A separate post will cover the connection process to specific IP Addresses.</div>
<h2>The process</h2>
<p>Below you will find the connection process in three simple steps.</p>
<p>Using a step by step elimination process, from a wide range of &#8220;all IP Addresses in a specific range&#8221; you come to connect to one or more specific Servers, based on availability and acceptance. Here is a brief overview:</p>
<ol>
<li><strong>Step 1: Ping the entire local network </strong>- All 256 IP Addresses in a specific range are pinged.</li>
<li><strong>Step 2: Who is a Server? Request Server Manifest</strong> &#8211; To all IP Addresses that  responded, a Server Manifest is requested</li>
<li><strong>Step 3: Attempting to connect to the found Servers</strong> &#8211; As not all Servers accept just anything, some might refuse an attempt to connect. The ones that allow you to connect will maintain a persistent Socket Connection until kingdom comes, or the connection is interrupted.</li>
</ol>
</div>
<h2><em>Step 1: Pinging the entire local Network</em></h2>
<div id="attachment_272" class="wp-caption alignnone" style="width: 604px"><a href="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_connect_step1.png"><img class="size-full wp-image-272" title="HotForestGreen_connect_step1" src="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_connect_step1.png?w=594&#038;h=534" alt="" width="594" height="534" /></a><p class="wp-caption-text">Pinging the local network</p></div>
<ol>
<li><strong>Client IP</strong> &#8211; Based on the IP address the Client is connected to, the IP range is determined in which the Client could find the Servers. This can be one or more IP addresses, depending on how the computer is connected.</li>
<li><strong>Simulatious ping</strong> &#8211; Per IP range a simultanious ping is done to all numbers inside that range, including the machine itself.</li>
<li><strong>Silence and response</strong> &#8211; Each IP address will either respond on the ping, or not respond at all.</li>
<ol>
<li><strong>Response</strong> &#8211; There is a machine on the other side. We do not know yet if it is a Server.</li>
<li><strong>No response</strong> &#8211; There is nothing there.</li>
</ol>
</ol>
<h2><em>Step 2: Who is a Server? Requesting the Server Manifest</em></h2>
<div id="attachment_273" class="wp-caption alignnone" style="width: 604px"><a href="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_connect_step2.png"><img class="size-full wp-image-273" title="HotForestGreen_connect_step2" src="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_connect_step2.png?w=594&#038;h=553" alt="" width="594" height="553" /></a><p class="wp-caption-text">Sending the Server Manifest Request</p></div>
<p>The next step is to find out who of our present machines is a Server or not. We do this as follows:</p>
<div>
<ol>
<li><strong>Get Server Manifest</strong> &#8211; To each IP address (that responded on the Ping of step 1) a request is sent for a Server Manifest.</li>
<li><strong>Silence and Response</strong> &#8211; Each machine that runs a HotForestGreen Server will respond with a Server Manifest. All machines which do not run a HotForestGreen Server will simply not be able to accept the attempt to connect from the Client</li>
</ol>
<h2><em>Step 3: Attempting to Connect to the Found Servers</em></h2>
</div>
<div>
<div id="attachment_274" class="wp-caption alignnone" style="width: 604px"><a href="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_connect_step3.png"><img class="size-full wp-image-274" title="HotForestGreen_connect_step3" src="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_connect_step3.png?w=594&#038;h=532" alt="" width="594" height="532" /></a><p class="wp-caption-text">Connecting to the Found Servers</p></div>
<p>For each Server we found in Step 2, we will attempt and receive the following:</p>
<ol>
<li><strong>Connect</strong> &#8211; The Client will not attempt to connect to the machines / IP Addresses that responded with a Server Manifest.</li>
<li><strong>Refusal and Acceptance</strong> &#8211; Based on the security levels set on the Server, the Server might expect the client to provide a specific handshake.</li>
<ol>
<li><strong>Accepted</strong> &#8211; Either the Server and Client share the same secret keywords, or are open to anyone. A persistent Socket Connection is created and maintained as long a s possible.</li>
<li><strong>Refused</strong> &#8211; Something did not match in the secret handshake between Client and Server. The Server or Client refuses to connect and no connection is established.</li>
</ol>
</ol>
<h2><em>End result of the Discovery and Elimination process</em></h2>
<div>At the end of the Discovery and Elimination process starting with all IP addresses, filtering out:</div>
<div>
<ol>
<li><strong>No response</strong> &#8211; All who give the silence of &#8220;no-one here</li>
<li><strong>Not a Server</strong> &#8211; Then all who are not a Server</li>
<li><strong>Not trusted</strong> &#8211; Then who are not trusted or do not trust you</li>
</ol>
<p>If all went well we are now connected to one or more Servers in the Network, able to send and receive real time data to other connected Clients in that Network.</p>
<h2><em>Time needed: less than 1 second</em></h2>
<p>The whole Discovery and Elimination Process is time-optimized and can take place in less than 1 second, as all 256 IP numbers are scanned simultaneously.</p>
<h2><em>Saving more system resources</em></h2>
<p>As most Servers will probably linger in the IP range from <span style="color:#3366ff;">xxx.xxx.xxx.<strong><span style="color:#ff0000;">00</span></strong></span><strong><span style="color:#ff0000;">1</span></strong> to &#8211; let&#8217;s say: <span style="color:#3366ff;">xxx.xxx.xxx</span>.<strong><span style="color:#ff0000;">o50</span></strong>, due to the way DNS numbers are issued to &#8220;who comes first gets the lowest number&#8221;, and most Servers where there before most Clients, a lot of overhead can be saved by scanning IP ranges in blocks of 20 to 40 successive addresses.</p>
<p>If this improvement will be implemented depends on negative experiences while running the framework and possible future developments to optimize this process even more.</p>
<h2><em>Plug and play</em></h2>
<p>No human interaction was needed:</p>
<ol>
<li><strong>To find and define the IP address(es) of the found Server(s)</strong> &#8211; as this was derived from the IP address assigned to the computer when it entered the network</li>
<li><strong>To find and to connect to the Application Cluster</strong> &#8211; As the load-balancing and the internal handshakes take care of connecting Clients to SandBoxes and exchange data within these SandBoxes between the Clients.</li>
</ol>
</div>
</div>
<h2>Once connected: Running multiple Sandboxes, Servers, Ports and Layers</h2>
<p>The auto-discovery process as shown above is only part of the whole story. In the image below I attempted to show all the options you have after a Server is discovered.</p>
<p>They will occur:</p>
<ol>
<li><strong>When you have multiple Servers</strong> &#8211; Arranging Load Balancing and Auto-wiring you to the proper Server, serving your requested SandBox</li>
<li><strong>Running your application over multiple ports</strong> &#8211; When you connect to other Ports in your network.</li>
</ol>
<h2><em>Why is this relevant?</em></h2>
<div>
<ol>
<li><strong>Multiple SandBoxes: separating data streams</strong> - You will have data you want to separate from others, to prevent data-leakage, data contamination (as you run Remote Objects with the same ID, but different objects attached to it) or simply to secure and shield specific data streams.</li>
<li><strong>Multiple Servers: reducing dependencies on one single machine</strong> - Once your application has to be more robust, you want to have fall back scenarios for when a Server drops out / crashes.</li>
<li><strong>Multiple ports: running multiple Servers on one machine</strong> &#8211; This started as a solution to allow me to test several Servers running simultaneously: sending Server State Manifests to each other to allow load balancing. As it is in place anyway, it has become part of the framework at large, for you to use. Leading to the possibility to create multiple Layers.</li>
<li><strong>Multiple Layers: separating streams even more</strong> &#8211; Your public services will run on one generic, default port, available to anyone to hook into. But some data running over your network, you want to keep private. Even more than possible via Secured SandBoxes. By running specific Servers over Specific Ports and using Trusted Clients as mediators between those layers, you are able to tap into both, exposing limited access to Stray Clients and hiding full access on some secret port.</li>
</ol>
</div>
<h2><em>Multiple SandBoxes, Servers and Layers visualized</em></h2>
<div>
<div id="attachment_275" class="wp-caption alignnone" style="width: 604px"><a href="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_connect_step4.png"><img class="size-full wp-image-275" title="HotForestGreen_connect_step4" src="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_connect_step4.png?w=594&#038;h=540" alt="" width="594" height="540" /></a><p class="wp-caption-text">Multiple Sanboxes, Servers, Ports and Layers</p></div>
<ol>
<li> <strong>Multiple Sandboxes over Multiple Servers</strong> &#8211; HotForestGreen Servers within the same network are interconnected and share their work-load. So when you connect to &#8220;a&#8221; Server, you might actually be re-directed to another IP address which is best to serve you for that specific SandBox.</li>
<ol>
<li><strong>Multiple Servers</strong> &#8211; The moment you need a more robust solution with fall-back scenarios in case of Server Failure, you will have two or more Servers in your network. All of these Servers communicate to each other, sharing their current state and work load in real time.</li>
<li><strong>Multiple SandBoxes</strong> &#8211; Each SandBox is a closed environment in which data is protected and shielded from accidental contamination. You will find that you will &#8211; soon enough &#8211; run two or more SandBoxes to host the data streams related to your application.</li>
</ol>
<li><strong>Multiple Layers by using Multiple Ports</strong> &#8211; One Cluster running over one single port over multiple machines can be considered one &#8220;Layer&#8221;.</li>
<ol>
<li><strong>Layers</strong> &#8211; A Layer is like a sheet of paper on which your network draws its data.</li>
<li><strong>Separating Layers</strong> &#8211; It is possible you want to run separate Layers and create &#8220;hidden layers&#8221; for specific tasks. For instance to separate your common and public data streams from the one that are more sensitive.</li>
<li><strong>Ports</strong> &#8211; A port is like a channel on which your broadcast your data. When you connect to that port, you will be able to receive the data. If you do not, the data will be invisible for you.</li>
<li><strong>Clients and Servers running on one Layer</strong> &#8211; Are able to discover each other and exchange information.</li>
<li><strong>Clients and Servers running on multiple Layers</strong> &#8211; Can only see and discover other LAyers by explicitly connecting to it.</li>
</ol>
</ol>
<h2>Fail saves</h2>
<p>The system has several fail saves built in for when machines drop out of the Network.</p>
<h2><em>Heartbeat and connection attempts</em></h2>
<p>When a Server is not up yet, the Client falls back on a constant heart beat of (by default) 20 seconds, in which all connections of all Sandboxes are checked. If no connection is there where it should be, the Client will attempt to (re) connect to a Server.</p>
<h2><em>Load balancing: pointing Clients to the right direction</em></h2>
<p>While Load Balancing might &#8211; at first &#8211; not be perceived that way, it is (and allows for) a fail save.</p>
<p>Here is how:</p>
<p>Each Server in the Network is aware of the State of each other Server. So when one Server drops out, all other Servers will know almost immediately and will be able to define which Server is most fit to jump in the gap and take over the services it provided.</p>
<p>When clients, who were connected to the disappeared Server, start requesting for new a new connection for a specific SandBox, the Load Balancing takes care of pointing them to the proper new Server that will handle their requests.</p>
<h2><em>Client- and Server side Caching: Preventing loss of real time data</em></h2>
<p>In this first version of the framework, data loss due to a Server Dropout, <strong>is not covered</strong>.</p>
<p>This will be covered by Server and Client side Data Caching. When Clients lose a connection, the data for that specific SandBox(es) can be buffered until a new connection is established, making sure no data is lost.</p>
<p>On the Server side, data received can be cached for all Clients who come in later: updating them on the events that happened in the past N seconds.</p>
<h2><em>Automated re-wiring of data connections</em></h2>
<p>This allows for scenarios where Servers drop out, crash or die, where Servers kick in later, or Servers are replaced/hot swapped. All while the application at large continues to function and run with no visible effect apart from the small hiccups when Clients and Servers start actively re-discovering and re-wiring their connections to other Servers.</p>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hotforestgreen.wordpress.com/271/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hotforestgreen.wordpress.com/271/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hotforestgreen.wordpress.com/271/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hotforestgreen.wordpress.com/271/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hotforestgreen.wordpress.com/271/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hotforestgreen.wordpress.com/271/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hotforestgreen.wordpress.com/271/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hotforestgreen.wordpress.com/271/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hotforestgreen.wordpress.com/271/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hotforestgreen.wordpress.com/271/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hotforestgreen.wordpress.com/271/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hotforestgreen.wordpress.com/271/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hotforestgreen.wordpress.com/271/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hotforestgreen.wordpress.com/271/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hotforestgreen.wordpress.com&amp;blog=22795962&amp;post=271&amp;subd=hotforestgreen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hotforestgreen.wordpress.com/2011/07/06/techdoc-the-automated-server-discovery-process-in-3-steps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cffc2ff7b980a5f5f76c22bddba4f361?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">peter kaptein</media:title>
		</media:content>

		<media:content url="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_connect_step1.png" medium="image">
			<media:title type="html">HotForestGreen_connect_step1</media:title>
		</media:content>

		<media:content url="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_connect_step2.png" medium="image">
			<media:title type="html">HotForestGreen_connect_step2</media:title>
		</media:content>

		<media:content url="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_connect_step3.png" medium="image">
			<media:title type="html">HotForestGreen_connect_step3</media:title>
		</media:content>

		<media:content url="http://hotforestgreen.files.wordpress.com/2011/07/hotforestgreen_connect_step4.png" medium="image">
			<media:title type="html">HotForestGreen_connect_step4</media:title>
		</media:content>
	</item>
		<item>
		<title>Update: July 5 &#8211; First tests with Remote Objects in the refactored code</title>
		<link>http://hotforestgreen.wordpress.com/2011/07/05/update-july-5-first-tests-with-remote-objects-in-the-refactored-code/</link>
		<comments>http://hotforestgreen.wordpress.com/2011/07/05/update-july-5-first-tests-with-remote-objects-in-the-refactored-code/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 20:33:55 +0000</pubDate>
		<dc:creator>Peter Kaptein</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://hotforestgreen.wordpress.com/?p=265</guid>
		<description><![CDATA[Summary Due to other priorities I wans not able to do much since June 19. Today I did two things: Test with synchronized Browsers &#8211; This test included the following elements: Synchronization of URLs &#8211; When one of the browsers navigates to another URL, all other browsers follow. Synchronization of scrolling &#8211; When one browser [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hotforestgreen.wordpress.com&amp;blog=22795962&amp;post=265&amp;subd=hotforestgreen&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Summary</h2>
<p>Due to other priorities I wans not able to do much since June 19.</p>
<p>Today I did two things:</p>
<ol>
<li><strong>Test with synchronized Browsers</strong> &#8211; This test included the following elements:</li>
<ol>
<li>Synchronization of URLs &#8211; When one of the browsers navigates to another URL, all other browsers follow.</li>
<li>Synchronization of scrolling &#8211; When one browser scrolls up and down the page, all other browsers follow.</li>
</ol>
<li><strong>Fix of bug in heartbeat</strong> &#8211; I removed a bug in the heart-beat of the Application SandBox. This lead to only one sandbox scanning and updating connections  when no connections were provided.</li>
</ol>
<p>The synchronized browser is one of the first proofs of concept and &#8211; as a project &#8211; will be cleaned up for reference.</p>
<h2>Primary target: make implementation of Synchronized Objects as easy as possible</h2>
<p>HotForestGreen is all about Synchronized (Remote) Objects.</p>
<p>Building this framework, I strive to create a solution that takes all the hard way out of the process, and only leaves the very basal things left for the coders using HotForestGreen.</p>
<p>This is slowly becoming reality. Each next iteration (there were 3 major ones in the past 2 months) makes it simpler to understand, without having to know the exact mechanics.</p>
<h2>30 minutes</h2>
<p>At the end of the ride, novice programmers should be able to have their first project with Distributed (Remote) Objects up and running in 30 minutes:</p>
<ol>
<li>Changing colors of screens of other computers</li>
<li>Browsing web pages simultaneous on multiple screens</li>
<li>Turning leds on and off on Arduino boards and via XBee modules by addressing (setting values on) Virtual Objects or Mediators</li>
</ol>
<h2>Open for improvement</h2>
<ol>
<li><strong>Layering applications over multiple ports fails</strong> - In the period of June 19 I implemented the options for multi-layered applications, living on several ports &#8220;on top of each other&#8221;. The idea is a bit like Flatland, where several universes can exist on top of each other. There are some bugs in the connection scheme which &#8211; right now &#8211; make connections from a Sandbox to one port fail if another is connected.</li>
<li><strong>Remote Objects seem te receive an echo of their data</strong> &#8211; When testing the Synchronized Browser, the Browser Object who sends an update to the Application Cluster seems to receive an echo of that update from the Server. This echo should not happen, as the object should be excluded from the recipient list.</li>
</ol>
<h2>Next steps</h2>
<p>Since I was not able to do anything since June 19, this list has not changed.</p>
<p>In the next weeks I will:</p>
<ol>
<li>Finalize the Security layer, part of Phase 2</li>
<li>Test, debug and clean up the prototype code for Phase 1 and 2.</li>
<li>Test and debug the framework with some basic applications</li>
</ol>
<h2>Main focus for the next days</h2>
<div>The main focus in the following days is on the following:</div>
<div>
<ol>
<li><strong>Multi-tier Client Server connections</strong> &#8211; Mainly needed for Server to Server tests. As only one Server can open a Socket Listener to one specific port, I need to be able to listen to multiple ports and run the application over these multiple tiers.</li>
<li><strong>Remove the echo from Remote Object Updates</strong> &#8211; Right now, Remote Objects seem to receive an acho from their own updates to the Application Cluster</li>
<li><strong>Improve the Event Model for debugging purposes</strong> - I added some improvements in the Event Model for Remote Objects and will extend that for Servers and Connections as well. The main purpose is to make monitoring of events easier. A good event model beats step by step tracing in debug mode when you want to know where things went wrong.</li>
</ol>
</div>
<p>The goal is to have something demo-able before August.</p>
<p>Finalizing Database access and working with databases is moved &#8211; for now &#8211; after getting the basic framework running and tested to satisfaction.</p>
<h2>Older Status Updates</h2>
<ul>
<li><a title="Update: Phase 1 of HotForestGreen almost done, implementing authentication" href="http://hotforestgreen.wordpress.com/2011/06/01/update-phase-1-of-hotforestgreen-almost-done-implementing-authentication/">June 1</a>: Prototype code for first phase of HotForestGreen almost done, implementing authentication</li>
<li><a title="Update: First round trip test successful" href="http://hotforestgreen.wordpress.com/2011/06/13/update-first-round-trip-test-successful/">June 13</a>: First round trip successful</li>
<li><a title="Update: June 19 – Getting a grip on all things considered" href="http://hotforestgreen.wordpress.com/2011/06/19/update-june-19-getting-a-grip-on-all-things-considered/">June 19</a>: Gettign a grip on all things considered. After a round of high-impact refactorings, things got to the point of functional again. Also contains a lot of background info on SandBoxes, the new security model, Systems of Trust and the revised Auto Connect system.</li>
<li>July 5: This post</li>
</ul>
<h2>What is this Framework about?</h2>
<p>See the post of <a title="Update: June 19 – Getting a grip on all things considered" href="http://hotforestgreen.wordpress.com/2011/06/19/update-june-19-getting-a-grip-on-all-things-considered/">June 19</a>. See also the &#8220;About&#8221; page <a href="http://hotforestgreen.wordpress.com/about/">here</a>.</p>
<h2>Update on roadmap</h2>
<h2><em>Phase 1: Building the basis – In progress per May 4, 2011</em></h2>
<p>Before June 10, 2011 I hope to finish Phase 1, which covers the basics on data, data conversion and Client/Server and Client/Client messaging. This includes:</p>
<ol>
<li><strong>Remote Objects</strong> – Sending and updating Remote Objects to all Remote clients</li>
<ol>
<li><em><strong>Status: June 19, 2011</strong></em></li>
<ol>
<li>Basis is tested last week. Found some bugs in retrieving persistant objects, leading to creation of news ones instead of retrieving the old</li>
<li>Need to be retested. Will be done in the next 2 weeks.</li>
</ol>
<li><em><strong>Status: July 5, 2011</strong></em></li>
<ol>
<li><strong>Bug: Echo from own data</strong> &#8211; Remote Objects seem to receive an echo from their own sent update. This is unwanted behavior.</li>
<li><strong>Bug: Application crashes</strong> &#8211; As Visual Studio rather crashes than show me which exception is not handled, it is hard to find what is going on. It is probably related to the Remote Objects.</li>
<li><strong>Test: Synchronized Browsers succesful</strong> &#8211; I have tested the Remote Objects in a simple experiment with synchronized browsers.</li>
<li><strong>Improvement of Event Model</strong> &#8211; The Remote Objects are receiving a more and more sophisticated Event Model, making it easier to monitor what is going on.</li>
</ol>
</ol>
<li><strong>Server feedback</strong> – Including IP numbers of Servers serving specific sandboxes</li>
<ol>
<li><em><strong>Status: June 19, 2011</strong></em></li>
<ol>
<li>Tested and in revision now. Refactored to make the message in standard BaseMessage format. Will do more refactoring today to revise the process of: &#8220;knock knock, who&#8217;s there?&#8221;</li>
</ol>
<li><em><strong>Status: July 5, 2011 </strong></em></li>
<ol>
<li>No progress.</li>
</ol>
</ol>
<li><strong>Heartbeats and auto-reconnect</strong> – Including auto-discovery of services and sandboxes and auto-reconnects when a Client connection drops or a Server drops out</li>
<ol>
<li><em><strong>Status: June 19, 2011</strong></em></li>
<ol>
<li>Revised to be independent of Servers running. To be tested in a Server Cluster.</li>
</ol>
<li><em><strong>Status: July 5, 2011</strong></em></li>
<ol>
<li><strong>Bug fix: Static timer</strong> &#8211; The timer used for the heartbeat of the SandBoxes only dealt with one of all registered sandboxes, as it was a static instead of a local variable.</li>
<li><strong>Preparation for multi-tier servers</strong> &#8211; To support multiple port numbers the SandBox connector is updated. Tests today to make it work properly have been cancelled. To be picked up later as it is only a priority to test Server to Server communication.</li>
<li><strong>Test</strong> &#8211; Auto connect seems to work fine. Within 20 seconds of a Server becoming available, the separate applications are synchronizing Remote objects.</li>
</ol>
</ol>
<li><strong>User Authentication</strong> – Including a basic “plug and play” scenario for logging into SandBoxes and assuring messages sent from a Client are “signed” by the user Credentials</li>
<ol>
<li><em><strong>Status: June 19, 2011</strong></em></li>
<ol>
<li>No further progress</li>
</ol>
<li><em><strong>Status: July 5, 2011</strong></em></li>
<ol>
<li>No progress</li>
</ol>
</ol>
<li><strong>Data manipulation</strong> – Using a “plug and play” approach via: “Transparant Data Access Layers” to access, change and store data in databases</li>
<ol>
<li><em><strong>Status: June 19, 2011</strong></em></li>
<ol>
<li>Tested first version three weeks ago. To be revisited after finalizing items 1 to 4.</li>
</ol>
<li><em><strong>Status: July 5, 2011</strong></em></li>
<ol>
<li>No progress</li>
</ol>
</ol>
<li><strong>Data Conversion</strong> – Including the conversions of Objects to “Comma Separated Values” vice versa, in order to:</li>
<ol>
<li><strong>Send updates</strong> – On Remote Objects through the network</li>
<li><strong>Reduce code for working with Databases</strong> – As we can inject data from databases into objects and database records</li>
</ol>
</ol>
<div>When these main items are done, I can release the code and start building some proof of concepts, showing the possibilities of the framework.</div>
<h2><em>Phase 2: Securing the framework – Started per June 16</em></h2>
<p>Phase 2 is about making the Framework more solid and more protected against people who want to hijack data and events.</p>
<ol>
<li><strong>Server to Server updates</strong> – Including: “I am currently serving Sandboxes A, B and C with a total of N connections”</li>
<ol>
<li><em><strong>Status: June 19, 2011</strong></em></li>
<ol>
<li>Started implementation of Secured SandBoxes to make this possible and simple</li>
<li>Implemented Server Sate Manifest as a Remote Object that contains the data per Server and automatically updates all other Servers when the state on that Server changes</li>
</ol>
<li><em><strong>Status: July 5, 2011</strong></em></li>
<ol>
<li><strong>Bug fix: Secret sandboxes not registered properly</strong> &#8211; Due to a bug in the refactored code, allowing for the creation of three different sandboxes: Open/Public, Trusted/Public  and Hidden, the Internal Server Manafest was not sent and received properly. This bug has been fixed yesterday.</li>
<li><strong>Other progress</strong> &#8211; Briefly tested, except from the bug fix, no progress made</li>
</ol>
</ol>
<li><strong>Load Balancing</strong> – Including a smart distribution of Sandboxes so that the load to serve Clients is shared by many</li>
<ol>
<li><em><strong>Status: June 19, 2011</strong></em></li>
<ol>
<li>Implemented, not tested yet. When a Client requests an IP number, the Client Socket will provide the IP of the Server that is least loaded.</li>
</ol>
<li><em><strong>Status: July 5, 2011</strong></em></li>
<ol>
<li>No progress made</li>
</ol>
</ol>
<li><strong>Server to Server security</strong> – Using handshakes and shared keys. Assuring that when a user plugs in a “Server” to intercept messages and sandboxes, this “Server” is refused by the network</li>
<ol>
<li><em><strong>Status: June 19, 2011</strong></em></li>
<ol>
<li>Work in progress. Servers now build up a Secured SandBox using the exact same mechanism as Clients, with the difference that they use an internal Shared Keyword to test if they can Trust the other Server</li>
</ol>
<li><em><strong>Status: July 5, 2011</strong></em></li>
<ol>
<li><strong>Trust relationships seem to work</strong> &#8211; The basic principle has been tested and trust-relationships seem to work. Connections are refused when a Client Server can not be trusted and three different type of SandBox Connections have been defined. See &#8220;Server to Server updates&#8221; under the update of July 5, 2011.</li>
<li><strong>More testing required</strong> &#8211; To be sure that the code is solid, more testing is required.</li>
</ol>
</ol>
<li><strong>SSL encryption</strong> – Currently all data sent is in Clear Text, making it extremely easy to hijack and abuse the system</li>
<ol>
<li><em><strong>Status: June 19, 2011</strong></em></li>
<ol>
<li>Not started yet</li>
</ol>
<li><em><strong>Status: July 5, 2011</strong></em></li>
<ol>
<li>Not started yet</li>
</ol>
</ol>
</ol>
<p>When these items are done, the Framework can withstand most basic attacks, can be scaled up by hot-plugging new Servers in the network and will continue to work even when multiple servers drop out.</p>
<h2><em>Phase 3: Opening up the framework – Not started yet</em></h2>
<p>While the basis is for specific use in a controlled environment, some things are missing to make the framework even more useful. These include:</p>
<ol>
<li><strong>The use of Web-sockets</strong> – For Socket-communication over port 80 in environments behind firewalls</li>
<li><strong>Porting the code from C# to Java and ActionScript</strong> – To provide a broader use base, allowing you to run the framework on:</li>
<ol>
<li> Android, Apple, Linux and in Flash</li>
<li>Intel and ARM-based devices</li>
</ol>
</ol>
<div>Other possibly needed ports I will leave up to the community that will hopefully emerge. I simply do not have the time.</div>
<h2><em>Phase 4: Testing and cleaning up – Not started yet</em></h2>
<p>In Phase 4 all crap and remaining leaks will be filtered out of the system. During phase 2, most issues have been tested and addressed, but as a part of the process.</p>
<p>The work includes:</p>
<ol>
<li><strong>Testing specific use-cases for performance</strong> - By running as much connections and messages as possible, until the system collapses</li>
<li><strong>Testing possible ways to hijack users and data</strong> – By scrutinizing the security model and implementing code that should break it</li>
<li><strong>Improving performance</strong> – By taking away data-hogs and</li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hotforestgreen.wordpress.com/265/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hotforestgreen.wordpress.com/265/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/hotforestgreen.wordpress.com/265/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/hotforestgreen.wordpress.com/265/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/hotforestgreen.wordpress.com/265/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/hotforestgreen.wordpress.com/265/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/hotforestgreen.wordpress.com/265/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/hotforestgreen.wordpress.com/265/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/hotforestgreen.wordpress.com/265/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/hotforestgreen.wordpress.com/265/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/hotforestgreen.wordpress.com/265/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/hotforestgreen.wordpress.com/265/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/hotforestgreen.wordpress.com/265/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/hotforestgreen.wordpress.com/265/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=hotforestgreen.wordpress.com&amp;blog=22795962&amp;post=265&amp;subd=hotforestgreen&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://hotforestgreen.wordpress.com/2011/07/05/update-july-5-first-tests-with-remote-objects-in-the-refactored-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/cffc2ff7b980a5f5f76c22bddba4f361?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">peter kaptein</media:title>
		</media:content>
	</item>
	</channel>
</rss>
