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

<channel>
	<title>Ivan Zuzak – blog</title>
	<atom:link href="https://izuzak.wordpress.com/feed/" rel="self" type="application/rss+xml"/>
	<link>https://izuzak.wordpress.com</link>
	<description></description>
	<lastBuildDate>Thu, 30 Dec 2010 18:53:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<site xmlns="com-wordpress:feed-additions:1">5951147</site><cloud domain="izuzak.wordpress.com" path="/?rsscloud=notify" port="80" protocol="http-post" registerProcedure=""/>
<image>
		<url>https://s2.wp.com/i/webclip.png</url>
		<title>Ivan Zuzak – blog</title>
		<link>https://izuzak.wordpress.com</link>
	</image>
	<atom:link href="https://izuzak.wordpress.com/osd.xml" rel="search" title="Ivan Zuzak - blog" type="application/opensearchdescription+xml"/>
	<atom:link href="https://izuzak.wordpress.com/?pushpress=hub" rel="hub"/>
	<itunes:explicit>no</itunes:explicit><itunes:subtitle/><item>
		<title>Blog moved to a new home at GitHub</title>
		<link>https://izuzak.wordpress.com/2010/12/30/blog-moved-to-a-new-home-at-github/</link>
					<comments>https://izuzak.wordpress.com/2010/12/30/blog-moved-to-a-new-home-at-github/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Zuzak]]></dc:creator>
		<pubDate>Thu, 30 Dec 2010 18:53:06 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">http://izuzak.wordpress.com/?p=530</guid>

					<description><![CDATA[I&#8217;ve moved the blog to a new home at ivanzuzak.info which is hosted on GitHub using GitHub Pages. If you&#8217;ve been following my blog here on WordPress &#8212; you can stop and switch to the new one because I won&#8217;t be posting here any more. WordPress has been fun, but having control over my content sounds fun [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I&#8217;ve moved the blog to a new home at <a href="http://ivanzuzak.info" target="_blank">ivanzuzak.info</a> which is hosted on <a href="http://github.com" target="_blank">GitHub</a> using <a href="http://pages.github.com/" target="_blank">GitHub Pages</a>. If you&#8217;ve been following my blog here on WordPress &#8212; you can stop and switch to the new one because I won&#8217;t be posting here any more. WordPress has been fun, but having control over my content sounds fun and GitHub is perfect for that. Thanks and all the best in 2011!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://izuzak.wordpress.com/2010/12/30/blog-moved-to-a-new-home-at-github/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">530</post-id>
		<media:content medium="image" url="https://1.gravatar.com/avatar/db8f5d658a8f5bfd6ed0442054eb545bfa58ae59aabb92e6495f372966d0d3de?s=96&amp;d=https%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96">
			<media:title type="html">izuzak</media:title>
		</media:content>
	</item>
		<item>
		<title>Pmrpc discovery and publish-subscribe support + systematization of cross-context browser communication systems</title>
		<link>https://izuzak.wordpress.com/2010/06/15/pmrpc-discovery-and-publish-subscribe-support-systematization-of-cross-context-browser-communication-systems/</link>
					<comments>https://izuzak.wordpress.com/2010/06/15/pmrpc-discovery-and-publish-subscribe-support-systematization-of-cross-context-browser-communication-systems/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Zuzak]]></dc:creator>
		<pubDate>Tue, 15 Jun 2010 21:14:04 +0000</pubDate>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[classification]]></category>
		<category><![CDATA[communication]]></category>
		<category><![CDATA[cookies]]></category>
		<category><![CDATA[cross-context]]></category>
		<category><![CDATA[cross-domain]]></category>
		<category><![CDATA[cross-origin]]></category>
		<category><![CDATA[discovery]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[inter-iframe]]></category>
		<category><![CDATA[inter-widget]]></category>
		<category><![CDATA[pmrpc]]></category>
		<category><![CDATA[postmessage]]></category>
		<category><![CDATA[publish-subscribe]]></category>
		<category><![CDATA[pubsub]]></category>
		<category><![CDATA[systematization]]></category>
		<category><![CDATA[url fragment]]></category>
		<category><![CDATA[web workers]]></category>
		<category><![CDATA[WebWorker]]></category>
		<guid isPermaLink="false">http://izuzak.wordpress.com/?p=484</guid>

					<description><![CDATA[This blog has moved to a new domain. You can view this post here. The pmrpc cross-context browser communication library has grown from the last time I blogged about it. Last time I wrote about adding support for RPC-style communication for WebWorkers. Today I&#8217;ll first introduce two new features &#8211; dynamic discovery of remote procedures [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><em><strong>This blog has moved to a <a href="http://ivanzuzak.info">new domain</a>. You can view this post <a href="http://ivanzuzak.info/2010/06/15/pmrpc-discovery-and-publish-subscribe-support-systematization-of-cross-context-browser-communication-systems.html">here</a>. </strong></em></p>
<p>The <a href="http://code.google.com/p/pmrpc/" target="_blank">pmrpc</a> cross-context browser communication library has grown from the <a href="http://wp.me/poYaf-44" target="_blank">last time I blogged about it</a>. Last time I wrote about adding support for RPC-style communication for <a href="http://www.whatwg.org/specs/web-workers/current-work/" target="_blank">WebWorkers</a>. Today I&#8217;ll first introduce two new features &#8211; dynamic <strong>discovery of remote procedures</strong> and a<strong> publish-subscribe communication model</strong>. Also, I&#8217;ll write about our <a href="http://code.google.com/p/pmrpc/wiki/IWCProjects" target="_blank"><strong>systematization of existing systems for cross-context browser communication</strong></a>.</p>
<h2>Discovery and publish subscribe</h2>
<p>Up until now, pmrpc supported only <a href="http://en.wikipedia.org/wiki/Remote_procedure_call" target="_blank">remote procedure call</a> as the communication model for inter-window and WebWorker communication. This model of communication is based on a client-server interaction where the client both a) has an object reference of the destination window/webworker context and b) knows the name of the remote procedure it wants to call. Here&#8217;s an example of a pmrpc RPC call:</p>
<pre class="brush: jscript; title: ; notranslate">
// server [window object A] exposes a procedure in it's window
pmrpc.register( {
  publicProcedureName : &quot;HelloPMRPC&quot;,
  procedure : function(printParam) { alert(printParam); }
} );
</pre>
<pre class="brush: jscript; title: ; notranslate">
// client [window object B] calls the exposed procedure remotely, from its own window
pmrpc.call( {
  destination : window.frames[&quot;myIframe&quot;],
  publicProcedureName : &quot;HelloPMRPC&quot;,
  params : [&quot;Hello World!&quot;]
} );
</pre>
<p>This works well for cases when the client knows how to obtain a reference of the server context object. However, it turns out that in many <a href="http://groups.google.com/group/pmrpc/browse_thread/thread/1a63a34971fd816e#" target="_blank">real-world</a> <a href="http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2009-September/022940.html" target="_blank">cases</a> <strong>the client </strong><strong>does not know which window/iframe/worker implements the procedure it wants to call</strong>. Mashups and widget portals are the best example. Imagine that both the client and the server are widgets on <a href="http://www.google.com/ig" target="_blank">iGoogle</a>. Although you may be in control of both the client and server iframe contents, in most cases you will not know the names of iframe elements which contain them and which are located on the top container page. And you need the values of the name attributes so that you can obtain a reference to the iframe object which you could then use to call postMessage.</p>
<p>This referencing problem was the motivation for implementing both the discovery and publish-subscribe features. Both features enable clients to call a remote procedure without a-priori knowing which destination object implements the  procedure. First, the<strong> publish-subscribe feature</strong> enables clients to perform a remote call without specifying the destination context object reference. If a publish-subscribe call is made, the pmrpc infrastructure will make a RPC call for the specified procedure to all window, iframe and WebWorker object it can find (thus simulating a &#8220;publish&#8221; event on a channel named by the remote procedure name). The API for using the publish-subscribe feature is simple; it reuses the <em>pmrpc.call</em> method and instead of passing the reference of the destination context object, a &#8220;publish&#8221; string parameter is passed instead:</p>
<pre class="brush: jscript; title: ; notranslate">
// server [window object A] exposes a procedure in it's window
pmrpc.register( {
  publicProcedureName : &quot;HelloPMRPC&quot;,
  procedure : function(printParam) { alert(printParam); }
} );
</pre>
<pre class="brush: jscript; title: ; notranslate">
// client [window object B] calls the exposed procedure remotely, from its own window
pmrpc.call( {
  destination : &quot;publish&quot;,
  publicProcedureName : &quot;HelloPMRPC&quot;,
  params : [&quot;Hello World!&quot;]
} );
</pre>
<p>Under the hood, the publish-subscribe feature uses the discovery feature to discover all window, iframe and WebWorker context objects and retrieves their references. Also, the publish-subscribe feature may be used with <a href="code.google.com/p/pmrpc/wiki/PmrpcApiDocs" target="_blank">other pmrpc features</a>, like access control and retries.</p>
<p>The <strong>discovery feature</strong> enables dynamic discovery of procedures registered at remote contexts and their filtering using various optional criteria. Discovered procedures may be filtered by the destination window/iframe/webworker context object, destination context origin (specified as a regular expression) and destination procedure name (also specified as a regular expression). For each discovered procedure that wasn&#8217;t filtered out, the procedure name, origin of the destination context, the access control rules specified for the procedure and the destination context object. The feature is implemented as a <strong>new pmrpc method</strong> &#8211; <em>pmrpc.discover</em>. The method is asynchronous and accepts a parameter object which specifies the filters and a callback method which will be called when all registered procedures are discovered. Here&#8217;s an example:</p>
<pre class="brush: jscript; title: ; notranslate">
// server [window object A] exposes a procedure in it's window
pmrpc.register( {
  publicProcedureName : &quot;HelloPMRPC&quot;,
  procedure : function(printParam) { alert(printParam); }
} );
</pre>
<pre class="brush: jscript; title: ; notranslate">
// client [window object B] discovers and calls the exposed procedure remotely, from its own window
var discoCallback = function(discoveredProcedures) {
  if (discoveredProcedures.length &gt; 0) {
    console.log(discoveredProcedures[0].publicProcedureName);
    console.log(discoveredProcedures[0].destinationOrigin);
    console.log(discoveredProcedures[0].procedureACL);
    pmrpc.call( {
      destination : discoveredProcedures[0].destination,
      publicProcedureName : &quot;HelloPMRPC&quot;,
      params : [&quot;Hello World!&quot;]
    } );
  }
};
pmrpc.discover( {
  destination : [window.frames[&quot;someiFrameName&quot;], window.frames[&quot;myIframe&quot;]],
  origin : &quot;.*goodOrigin.*&quot;,
  publicProcedureName : &quot;.*Hello.*&quot;,
  callback : discoCallback
} );
</pre>
<p>The implementation of the discover method is based on <strong>recursively visiting every iframe in the window.frames object starting from window.top</strong>:</p>
<ol>
<li>The method fetches a reference to the top window object (window.top), adds the reference to the result array and repeats the procedure for each nested iframe (by iterating through the window.frames object). This way, all iframes in the current window are visited. This process is depicted by the figure below.</li>
<li>The method adds all local web worker objects to the result array.</li>
<li>On each context object in the result array, a special pmrpc infrastructure method is invoked to obtain a list of registered procedures.</li>
<li>The list of all obtained procedures is filtered by the specified criteria.</li>
<li>The method invokes the callback, passing the list of discovered procedures as a parameter.</li>
</ol>
<p>It&#8217;s not an ideal way of discovering remote contexts, but it&#8217;s better than nothing and works with the latest versions of all major browsers.</p>
<p style="text-align:center;"><img data-attachment-id="505" data-permalink="https://izuzak.wordpress.com/2010/06/15/pmrpc-discovery-and-publish-subscribe-support-systematization-of-cross-context-browser-communication-systems/discoarchitecture-1/" data-orig-file="https://izuzak.wordpress.com/wp-content/uploads/2010/06/discoarchitecture-1.png" data-orig-size="960,720" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="Discovery architecture" data-image-description="" data-image-caption="" data-large-file="https://izuzak.wordpress.com/wp-content/uploads/2010/06/discoarchitecture-1.png?w=720" class="aligncenter size-full wp-image-505" title="Discovery architecture" src="https://izuzak.wordpress.com/wp-content/uploads/2010/06/discoarchitecture-1.png?w=720" alt=""   srcset="https://izuzak.wordpress.com/wp-content/uploads/2010/06/discoarchitecture-1.png?w=576&amp;h=432 576w, https://izuzak.wordpress.com/wp-content/uploads/2010/06/discoarchitecture-1.png?w=150&amp;h=113 150w, https://izuzak.wordpress.com/wp-content/uploads/2010/06/discoarchitecture-1.png?w=300&amp;h=225 300w, https://izuzak.wordpress.com/wp-content/uploads/2010/06/discoarchitecture-1.png?w=768&amp;h=576 768w, https://izuzak.wordpress.com/wp-content/uploads/2010/06/discoarchitecture-1.png 960w" sizes="(max-width: 576px) 100vw, 576px" /></p>
<h2>Systematization of cross-context browser communication systems</h2>
<p>It&#8217;s evident that the WWW is becoming ever more componentized as almost every web site is a mashup, contains widgets or uses WebWorkers. As a result, there has been a increase in development of systems that enable communication between these different browser contexts &#8211; windows, iframes and WebWorkers. Pmrpc is only one example of such system and lots of other systems exist. However, as the number of these systems increases, the<strong> understanding of each systems&#8217; capabilities and their comparison and evaluation becomes a more difficult task</strong> since no effort is being made to systematize this ecosystem.</p>
<p>This is why <a href="http://twitter.com/ivankovic_42" target="_blank">Marko</a> and I are trying to create a <strong>systematization of existing cross-context communication systems</strong>. Our work on this systematization is in its early stages but is openly available to anyone at a <a href="http://code.google.com/p/pmrpc/wiki/IWCProjects" target="_blank">pmrpc wiki page</a>. At the moment we are trying to do the following:</p>
<ol>
<li>Make a list of all mechanisms for cross-context communication. We are including both in-browser mechanisms like the postMessage API, cookies and URL fragment, and 3rd party libraries like <a href="http://easyxdm.net/" target="_blank">easyXDM</a> and pmrpc.</li>
<li>Define <strong>dimensions for classifying the gathered systems</strong>. Each dimension defines a system characteristic whereas values along each dimension define a set of possible design choices.  Currently, we have defined about a dozen dimension and are still thinking some through. Here are some examples: <em>Type of system</em> (browser built-in, pure client-side framework, server-mediated initialization framework, server-mediated communication framework), <em>Transport mechanism</em> (cookies, URL fragment, postMessage, &#8230;), <em>Programming model</em> (message-oriented, shared memory, RPC, publish-subscribe).</li>
<li>Evaluate the listed systems according to the defined dimensions.</li>
</ol>
<p>I&#8217;d <a href="http://groups.google.com/group/pmrpc" target="_blank">love to hear</a> what you think of the new pmrpc features and the systematization (see more examples at our <a href="http://code.google.com/p/pmrpc/wiki/PmrpcApiDocs" target="_blank">API docs page</a>)! Do you know of any cross-context communication systems that are not listed? Do you think some other system characteristic should be included in the classification? <a href="http://twitter.com/izuzak" target="_blank">@izuzak</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://izuzak.wordpress.com/2010/06/15/pmrpc-discovery-and-publish-subscribe-support-systematization-of-cross-context-browser-communication-systems/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">484</post-id>
		<media:content medium="image" url="https://1.gravatar.com/avatar/db8f5d658a8f5bfd6ed0442054eb545bfa58ae59aabb92e6495f372966d0d3de?s=96&amp;d=https%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96">
			<media:title type="html">izuzak</media:title>
		</media:content>

		<media:content medium="image" url="https://izuzak.wordpress.com/wp-content/uploads/2010/06/discoarchitecture-1.png">
			<media:title type="html">Discovery architecture</media:title>
		</media:content>
	</item>
		<item>
		<title>Why understanding REST is hard and what we should do about it – systematization, models and terminology for REST</title>
		<link>https://izuzak.wordpress.com/2010/04/03/why-understanding-rest-is-hard-and-what-we-should-do-about-it-systematization-models-and-terminology-for-rest/</link>
					<comments>https://izuzak.wordpress.com/2010/04/03/why-understanding-rest-is-hard-and-what-we-should-do-about-it-systematization-models-and-terminology-for-rest/#comments</comments>
		
		<dc:creator><![CDATA[Ivan Zuzak]]></dc:creator>
		<pubDate>Sat, 03 Apr 2010 08:19:21 +0000</pubDate>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[architectural styles]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[automata]]></category>
		<category><![CDATA[collaboration]]></category>
		<category><![CDATA[comunity]]></category>
		<category><![CDATA[finite state machine]]></category>
		<category><![CDATA[formal model]]></category>
		<category><![CDATA[FSM]]></category>
		<category><![CDATA[hypermedia]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[NFA]]></category>
		<category><![CDATA[nondeterministic]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[WWW]]></category>
		<guid isPermaLink="false">http://izuzak.wordpress.com/?p=190</guid>

					<description><![CDATA[This blog has moved to a new domain. You can view this post here. This is going to be another long post, so I&#8217;m using the introduction as an overview again. Introduction This post is about understanding REST, the software architectural style behind the World Wide Web. My Ph.D. research, which I&#8217;ll write about some [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><em><strong>This blog has moved to a <a href="http://ivanzuzak.info">new domain</a>. You can view this post <a href="http://ivanzuzak.info/2010/04/03/why-understanding-rest-is-hard-and-what-we-should-do-about-it-systematization-models-and-terminology-for-rest.html">here</a>. </strong></em></p>
<p>This is going to be another long post, so I&#8217;m using the introduction as an overview again.</p>
<p><span style="font-family:Verdana;font-style:normal;line-height:normal;"> </span></p>
<h3 style="font-size:12pt;text-align:left;"><strong>Introduction</strong></h3>
<p style="text-align:justify;">This post is about <strong>understanding </strong><a href="http://en.wikipedia.org/wiki/Representational_State_Transfer" target="_blank"><strong>REST</strong></a>, the <a href="http://en.wikipedia.org/wiki/Software_architecture" target="_blank">software architectural</a> <a href="http://www.ics.uci.edu/~fielding/pubs/dissertation/software_arch.htm#sec_1_5" target="_blank">style</a> behind the <a href="http://en.wikipedia.org/wiki/WWW" target="_blank">World Wide Web</a>. My Ph.D. research, which I&#8217;ll write about some other time, pushed me on the road of REST and over the last year I&#8217;ve been reading <a href="http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm" target="_blank">lots</a> <a href="http://portal.acm.org/citation.cfm?id=1367606" target="_blank">of</a> <a href="http://www.vs.inf.ethz.ch/res/papers/dguinard_09_WOTMashups.pdf" target="_blank">research</a> <a href="http://portal.acm.org/citation.cfm?id=1287624.1287660" target="_blank">papers</a>, <a href="http://www.amundsen.com/blog/" target="_blank">lots</a> <a href="http://www.nordsc.com/blog/" target="_blank">of</a> <a href="http://roy.gbiv.com/untangled/" target="_blank">blogs</a>, <a href="http://tech.groups.yahoo.com/group/rest-discuss/" target="_blank">lots</a> <a href="http://lists.w3.org/Archives/Public/public-lod/" target="_blank">of</a> <a href="http://lists.w3.org/Archives/Public/www-tag/" target="_blank">mailing</a> <a href="http://lists.w3.org/Archives/Public/ietf-http-wg/" target="_blank">lists</a>, <a href="http://twitter.com/mamund/status/10672950825" target="_blank">lots</a> <a href="http://twitter.com/dret/status/9930545464" target="_blank">of</a> <a href="http://twitter.com/stilkov/status/9029759744" target="_blank">tweets</a>, <a href="http://www.youtube.com/watch?v=YCcAE2SCQ6k" target="_blank">lots</a> <a href="http://www.davidgiard.com/2010/03/15/MikeAmundsenOnHTTPAndREST.aspx" target="_blank">of</a> <a href="http://www.infoq.com/interviews/Restfulie" target="_blank">videos</a>, <a href="http://rest.blueoxen.net/cgi-bin/wiki.pl" target="_blank">wikis</a>, <a href="http://www.softwarearchitecturebook.com/" target="_blank">books</a> and <a href="http://rest.hackyhack.net/" target="_blank">IRC transcripts</a> on REST and I&#8217;ve also recently started the <em>This Week in REST</em> <a href="http://rest.blueoxen.net/cgi-bin/wiki.pl?RESTWeekly" target="_blank">wiki</a> and <a href="http://thisweekinrest.wordpress.com/" target="_blank">blog</a>. In other words, I&#8217;ve read almost everything I could find on REST. So, in the first part of this post I&#8217;ll write about several thoughts which stuck with me while researching REST:</p>
<ol style="text-align:justify;">
<li><strong>REST is and will continue to be important</strong> &#8211; it&#8217;s the foundation of the WWW and will be the foundation of its future stages and dimensions, like the <a href="http://en.wikipedia.org/wiki/Semantic_Web" target="_blank">Semantic Web</a> and the <a href="http://en.wikipedia.org/wiki/Web_of_Things" target="_blank">Web of Things</a>.</li>
<li><strong>Understanding REST is hard</strong> &#8211; the material on REST is fragmented and there is no clearly defined and systematized terminology or formal models used in discussions.</li>
<li style="text-align:justify;"><strong>We can and should fix the problem</strong> &#8211; there are enough motivated and smart people who can, through an open and collaborative process, create a better way of fully understanding REST.</li>
</ol>
<p style="text-align:justify;">In the second part of the post I&#8217;ll add to the pile of scattered fragments on understanding RESTful systems and <strong>describe an abstract model of a simplified REST user-agent using </strong><strong><a href="http://en.wikipedia.org/wiki/Finite_state_machine" target="_blank">finite state machines</a></strong>. It&#8217;s a very basic model but serves the purpose of showing that it is both possible and useful to develop such formal models.</p>
<p style="text-align:justify;">I hope this post will motivate people involved and interested in REST to contribute to a process for improving the understanding of REST. I was planing to write my thoughts as a paper for the <a href="http://www.ws-rest.org/" target="_blank">First International Workshop on RESTful Design (WS-REST 2010)</a> but didn&#8217;t have enough time. Nevertheless, I hope that people who are going to the workshop will talk about this issue. I&#8217;ll start a thread on the REST mailing list for following up on these ideas, so please comment there if you want to join the discussion (<strong><em>EDIT: thread is </em></strong><strong><em><a href="http://tech.groups.yahoo.com/group/rest-discuss/messages/15200?threaded=1&amp;m=e&amp;var=1&amp;tidx=1" target="_blank">here</a><span style="font-weight:normal;"><span style="font-style:normal;">)</span></span></em></strong>.</p>
<h2 style="text-align:justify;">Representational State Transfer and why it&#8217;s important</h2>
<p style="text-align:justify;">Although this post is about understanding the REpresentational State Transfer (REST) software architectural style, I&#8217;m not going to write another REST introduction. If you don&#8217;t know anything about REST, start from the <a href="http://en.wikipedia.org/wiki/Representational_State_Transfer" target="_blank">wikipedia article</a> and go from there.</p>
<p style="text-align:justify;"><a href="http://www.flickr.com/photos/psd/2918889380/" target="_blank"><img class="alignright" style="margin:5px;" src="https://i0.wp.com/farm4.static.flickr.com/3175/2918889380_994055f2f9_b.jpg" alt="" width="202" height="256" /></a></p>
<p style="text-align:justify;">What&#8217;s more important for this post is that <strong>REST is and will continue to be an essential part of the WWW</strong>.  First, through the <a href="http://tools.ietf.org/html/rfc3986" target="_blank">Web&#8217;s</a> <a href="http://tools.ietf.org/id/draft-fielding-http-p" target="_blank">core</a> <a href="http://dev.w3.org/html5/spec/Overview.html" target="_blank">technologies</a>, REST is responsible for most of the <a href="http://en.wikipedia.org/wiki/Representational_State_Transfer#Key_goals" target="_blank">good properties of the current Web</a> as a large-scale network-based system. Second, REST principles guide the development of both the next &#8220;major&#8221; generations of the Web, like the <a href="http://en.wikipedia.org/wiki/Semantic_Web" target="_blank">Semantic Web</a>, the <a href="http://en.wikipedia.org/wiki/Web_of_Things" target="_blank">Web of Things</a> and the <a href="http://en.wikipedia.org/wiki/Real_time_web" target="_blank">Real-time Web</a>, and the &#8220;minor&#8221; incremental <a href="http://tools.ietf.org/html/draft-nottingham-site-meta-05" target="_blank">changes</a> <a href="http://tools.ietf.org/html/draft-duerst-iri-bis" target="_blank">of</a> <a href="http://tools.ietf.org/html/draft-hammer-discovery" target="_blank">continuous</a> <a href="http://www.w3.org/2001/tag/group/track/issues/31" target="_blank">evolution</a>. Whereas the Semantic Web is about <a href="http://en.wikipedia.org/wiki/Resource_Description_Framework" target="_blank">exposing</a> and <a href="http://en.wikipedia.org/wiki/Linked_Data" target="_blank">interlinking</a> data on the WWW, the Web of Things is about <a href="http://www.slideshare.net/misterdom/web-of-things-connecting-people-and-objects-on-the-web-3425316" target="_blank">connecting and exposing</a> every physical thing to it and the Real-time Web is about <a href="http://code.google.com/p/pubsubhubbub/" target="_blank">real-time access</a> to that data and things. Therefore, understanding the <a href="http://www.w3.org/TR/webarch/" target="_blank">Web today</a>, it&#8217;s <a href="http://journal.webscience.org/146/" target="_blank">future evolution</a> and the <a href="http://bitworking.org/projects/atom/rfc5023.html" target="_blank">whole</a><a href="http://tools.ietf.org/html/draft-nottingham-http-link-header" target="_blank"> technology</a> <a href="http://www.w3.org/TR/rdf-sparql-query/" target="_blank">jungle</a> <a href="http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol" target="_blank">on</a> <a href="http://wiki.webhooks.org/" target="_blank">top</a> is based on the understanding of REST. Third, REST is important as a research subject on its own (although some people <a href="http://www.subbu.org/blog/2009/07/is-this-restful" target="_blank">think it isn&#8217;t</a> <strong><em>EDIT: Subbu elaborated on this misunderstanding below in the comment section</em></strong>) and will be <a href="http://www2009.org/proceedings/pdf/p911.pdf" target="_blank">analyzed</a> and built upon to define <a href="http://www.erenkrantz.com/CREST/" target="_blank">new</a> <a href="http://www.ics.uci.edu/~rohit/Khare-Thesis-FINAL.pdf" target="_blank">architectural</a> <a href="http://homepages.cwi.nl/~arie/papers/spci/spiar-jss.pdf" target="_blank">styles</a>.</p>
<h2>Understanding REST</h2>
<p style="text-align:justify;">In my experience, <strong>understanding REST is far from easy</strong>. Of course, not everyone needs to understand REST and different people may want or need to understand REST at different levels and depths. However, despite it being a highly technical and academic concept not everyone should easily and fully grasp, I think it&#8217;s hard even for people aimed at &#8211; computer scientists, software engineers and web architects. After reading everything I could find on REST and the WWW, here are the problems I believe are responsible for this:</p>
<p style="text-align:justify;"><a href="http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_3_1"><img class="alignright" style="margin:5px;" src="https://i0.wp.com/www.codeproject.com/KB/aspnet/NoteOnWebApplications/Figure2.gif" alt="" width="320" height="145" /></a>First, <strong>the REST master reference</strong>, <a href="http://www.ics.uci.edu/~fielding/" target="_blank">Roy Fielding&#8217;s</a> <a href="http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm" target="_blank">doctoral dissertation</a> (and subsequent <a href="http://portal.acm.org/citation.cfm?id=514183.514185" target="_blank">academic</a> <a href="http://portal.acm.org/citation.cfm?id=337228" target="_blank">papers</a>), <strong>is not completely suitable for fully understanding REST</strong>. For a doctoral dissertation, it&#8217;s severely lacks images explaining important concepts in the two <a href="http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_2" target="_blank">key</a> <a href="http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_3" target="_blank">sections</a> on REST. However, I bet everyone knows the single image in those sections almost by heart from how much it&#8217;s being repeated everywhere (for those who don&#8217;t, that&#8217;s the image on the right). The same could be said for the lack of (formal) models to describe specific properties, elements or views of REST, like <a href="http://en.wikipedia.org/wiki/HATEOAS" target="_blank">HATEOAS</a>. It&#8217;s as if the very clean and systematic approach of explaining <a href="http://www.ics.uci.edu/~fielding/pubs/dissertation/software_arch.htm" target="_blank">software architecture</a> and <a href="http://www.ics.uci.edu/~fielding/pubs/dissertation/net_arch_styles.htm" target="_blank">network-based architectural styles</a> present in the first few chapters of his Ph.D. somehow vanished in those two sections. I am aware that there are no formal models for defining architectural styles as a whole (at least, <a href="http://csse.usc.edu/~mehta/phd/dissertation.pdf" target="_blank">there weren&#8217;t any then</a>), but using models like <a href="http://en.wikipedia.org/wiki/Finite-state_machine" target="_blank">state machines</a>, <a href="http://en.wikipedia.org/wiki/Petri_net" target="_blank">Petri nets</a> or <a href="http://en.wikipedia.org/wiki/Process_calculus" target="_blank">process calculi</a> to describe and explain parts of it would have definitely been of great benefit. It&#8217;s that absolute clarity of formal models that helps when you need to have a complete grasp of a concept. Furthermore, since models are abstract methods for explaining specific problems, people only need to research the underlying model after which the specific use of the model is unambiguously clear. And just to be clear, I think Roy&#8217;s dissertation is overall well written and has had a big impact on both the academia and industry, and I very well know that making everyone on the planet happy with a research paper is idiotic (looking for a good Ph.D. comics reference for this), but I still wish those two sections were a bit more thorough and polished.</p>
<p style="text-align:justify;">Second, since Roy&#8217;s dissertation doesn&#8217;t have clear answers for all questions, people start discussions over understanding specific parts of REST all over the Web. <strong>Relevant discussions are scattered</strong> over many mailing lists, blogs, Twitter accounts, wikis, academic papers, videos and even IRC transcripts (see the introduction for links to some of these). More often than not these <strong>discussion are not focused on REST</strong> per se, but <a href="http://derivadow.com/2010/02/18/the-problem-with-breadcrumb-trails/" target="_blank">on</a> <a href="http://lists.w3.org/Archives/Public/www-tag/2010Feb/0002.html" target="_blank">anything</a> <a href="http://www.mail-archive.com/public-lod@w3.org/msg04387.html" target="_blank">related</a> <a href="http://masinter.blogspot.com/2010/03/resources-are-angels-urls-are-pins.html" target="_blank">to</a> <a href="http://www.webofthings.com/2010/02/02/sharing-in-a-web-of-things/" target="_blank">the</a> <a href="http://highscalability.com/blog/2010/3/26/strategy-caching-404s-saved-the-onion-66-on-server-time.html" target="_blank">Web</a>, various <a href="http://lists.w3.org/Archives/Public/public-lod/2010Mar/0203.html" target="_blank">specifics</a> <a href="http://lists.w3.org/Archives/Public/www-tag/2010Mar/0045.html" target="_blank">concerning</a> <a href="http://www.mnot.net/cache_docs/" target="_blank">current</a> <a href="http://lists.w3.org/Archives/Public/www-tag/2009Dec/0070.html" target="_blank">and</a> <a href="http://www.kimchy.org/rest_and_web_sockets/" target="_blank">future</a> <a href="http://lists.w3.org/Archives/Public/ietf-http-wg/2010JanMar/0337.html" target="_blank">standards</a> and so on. And even more often, the <strong>discussions unnecessarily repeat previous discussions</strong> probably because the authors are unaware that the same discussion exists elsewhere or it&#8217;s that those are too difficult to search for. For example, the HATEOAS constraint is getting <a href="http://weblogs.java.net/blog/mkarg/archive/2010/02/14/what-hateoas-actually-means" target="_blank">a</a> <a href="http://www.amundsen.com/blog/archives/1005" target="_blank">lot</a> <a href="http://www.slideshare.net/skillsmatter/hydras-and-hypermedia" target="_blank">of</a> <a href="http://www.infoq.com/articles/mark-baker-hypermedia" target="_blank">attention</a> <a href="http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven" target="_blank">everywhere</a>. So there&#8217;s lots of unorganized, scattered, duplicated and mutually disconnected fragments on REST and it&#8217;s unclear where and how to find the ones that answer your questions. No, <a href="http://www.google.com/search?hl=en&amp;q=REST" target="_blank">Googling</a> won&#8217;t help as often as you&#8217;d like, no, a <a href="http://www.infoq.com/minibooks/emag-03-2010-rest" target="_blank">series of unrelated articles</a> piled up together won&#8217;t either (though <a href="http://twitter.com/mamund" target="_blank">Mike Amundsen&#8217;s tweets</a> often will), and yes, a-big-unorganized-mess is kind of the point of the Web in general, however it&#8217;s not the optimal methodology for <strong>systematizing knowledge in a way required</strong><strong> for understanding complex concepts like REST</strong>.</p>
<p><img loading="lazy" class="alignright" style="margin:5px;" src="https://i0.wp.com/images.ctv.ca/archives/CTVNews/img2/20080516/450_messy1_080516.jpg" alt="" width="325" height="225" /></p>
<p style="text-align:justify;">Third, these <strong>fragments on REST often use mutually different terminology, same terminology with different meaning</strong><strong> or terminology which is not explicitly defined</strong>. My favorite example is the word &#8220;state&#8221; which is overloaded with unexplained and overlapping meaning. &#8220;Resource state&#8221;, &#8220;session state&#8221;, &#8220;control state&#8221;, &#8220;client state&#8221;, &#8220;server state&#8221;, &#8220;application state&#8221;, &#8220;transaction state&#8221;, &#8220;steady state&#8221; and &#8220;transient state&#8221; are some of the terms used and it is not completely clear what some of those mean, how they are related and which REST elements use, change and transfer them and when. For example, <a href="http://tech.groups.yahoo.com/group/rest-discuss/message/14671" target="_blank">what is client state</a>? Is it something related to the client connector type? Is it something stored on the client component? If so, then <a href="http://tech.groups.yahoo.com/group/rest-discuss/message/15074" target="_blank">why is it not called user agent</a> state? Is client state a union of session and application state? Or is application state a synonym for session state? Which states does a <a href="http://tech.groups.yahoo.com/group/rest-discuss/message/14643" target="_blank">steady state relate to</a> &#8211; client, session or application? Which entities may change session state and when? Yes, some of these concepts are completely clear, <a href="http://tech.groups.yahoo.com/group/rest-discuss/message/15116" target="_blank">but some are not</a> and different people use them with different meaning. Still, the most entertaining situations are the ones in which people write only &#8220;state&#8221; and then you have to figure out which state they are referring to. Yeah, good luck. And there are other both simple and complex examples, from stating that REST methods are to be executed over representations instead of resources and discussing if ATOM is <a href="http://tech.groups.yahoo.com/group/rest-discuss/message/15061" target="_blank">RESTful</a> <a href="http://tech.groups.yahoo.com/group/rest-discuss/message/14718" target="_blank">or not</a> to explaining just what is an <em>application </em>in terms of REST. Lastly, similar to Roy&#8217;s dissertation, these discussion rarely use diagrams or formal models to explain anything.</p>
<p style="text-align:justify;">These problems confuse people trying to learn REST on a basic level and make it hard to discuss REST on deeper levels.</p>
<h2>What we should do about it</h2>
<p style="text-align:justify;">Now, I&#8217;m not implying that these problems will cause the apocalypse if we don&#8217;t solve them, but I&#8217;d sure like it if they go away (and lots of other people would also). So here are my suggestions:</p>
<p style="text-align:justify;">First, <strong>a mess is still better than nothing</strong>. Everyone should at least continue with thinking, writing and talking about REST and create more fragments. Chances are that those fragments will help a fair amount of people interested in REST. I definitely learned a lot from <a href="http://www.markbaker.ca/blog/" target="_blank">reading</a> <a href="http://amundsen.com/blog/" target="_blank">excellent</a> <a href="http://www.nordsc.com/blog/" target="_blank">blogs</a>, <a href="http://www.twibes.com/group/rest?id=817190" target="_blank">tweets</a>, <a href="http://dret.net/netdret/publications" target="_blank">papers</a> and <a href="http://tech.groups.yahoo.com/group/rest-discuss/messages/14643?threaded=1&amp;m=e&amp;var=1&amp;tidx=1" target="_blank">mailing list posts</a> (Ryan&#8217;s <a href="http://tomayko.com/writings/rest-to-my-wife" target="_blank">explanation of REST to his wife</a> is especially entertaining, besides educational).</p>
<p style="text-align:justify;">Second, I think this problem can and <strong>should be solved collaboratively and openly</strong>, not by single person (not even Roy Fielding) or as just another academic paper. If there&#8217;s going to be agreement over terminology, it&#8217;s meaning, models, and other ways of making understanding REST easier, this agreement must be backed by people who have relevant REST experience and must be open to comments from everyone else. Furthermore, untangling the mess will require a lot of work. So, in my opinion, the REST community (whatever that is) should:</p>
<div id="_mcePaste">
<ol>
<li style="text-align:justify;">Agree that there is a problem worth fixing &#8211; do we think that we can create a better, clearer and more systematized way of understanding and discussing about REST?</li>
<li style="text-align:justify;">Express interest in fixing it &#8211; is this something people want to contribute their time to?</li>
<li style="text-align:justify;">Agree on how to fix it &#8211; what should be our output (a RESTopedia, a document, video tutorials) and how would we all contribute to and moderate the process?</li>
<li style="text-align:justify;">Do it &#8211; spend time discussing and developing the output.</li>
<li style="text-align:justify;">Eat our dogfood &#8211; use whatever we produce. If we don&#8217;t use the terminology and models we agree upon, the the mess has only gotten bigger.</li>
</ol>
</div>
<p><img loading="lazy" class="alignright" style="margin:5px;" src="https://i0.wp.com/farm4.static.flickr.com/3199/3330670980_dab9f6b5c8.jpg" alt="" width="320" height="213" /></p>
<p style="text-align:justify;"><a href="http://twitter.com/distobj" target="_blank">There</a> <a href="http://twitter.com/sallamar" target="_blank">are</a> <a href="http://twitter.com/guilhermecaelum" target="_blank">more</a> <a href="http://twitter.com/iansrobinson" target="_blank">than</a> <a href="http://twitter.com/mamund" target="_blank">enough</a> <a href="http://twitter.com/algermissen" target="_blank">smart</a> <a href="http://twitter.com/stilkov" target="_blank">and</a> <a href="http://twitter.com/dret" target="_blank">motivated</a> <a href="http://twitter.com/andrewwahbe" target="_blank">people</a> with different backgrounds and experience with REST and RESTful HTTP to make this happen and it would have a big impact if done (even more if done right). I myself am not sure what the best output would be and how to achieve it, but would like it to be a hypermedia document available freely on the WWW, contain a systematized intersection of terminology, images, models and rationale that everyone agrees upon and focus on REST, using HTTP/URI/HTML only for examples (not the other way around).</p>
<h2>Formal models for REST &#8211; a FSM model of a simplified RESTful user-agent</h2>
<p style="text-align:justify;">First off, <strong>developing useful formal models for understanding architectural styles isn&#8217;t easy</strong> since architectural styles are named sets of constraints commonly defined using natural language, rarely using formalisms. Also, models of REST concepts should include as many other REST concepts as possible &#8211; e.g. a model of HATEOAS should somehow clear up how application state, representations, methods, resources, steady states, transient states and other concepts all play their role in HATEOAS. It&#8217;s not easy to model this in a clear and simple way. Nevertheless, these kinds of models are especially important since they connect rather than disperse concepts.</p>
<p style="text-align:justify;">Mike Amundsen&#8217;s and Jan Algermissen&#8217;s <a href="http://www.amundsen.com/blog/archives/1032" target="_blank">poking</a> <a href="http://rest.hackyhack.net/2010-02-13.html#168/h168" target="_blank">at</a> <a href="http://tech.groups.yahoo.com/group/rest-discuss/messages/15101?threaded=1&amp;m=e&amp;var=1&amp;tidx=1" target="_blank">REST steady states</a> was very thought-provoking for me &#8211; excerpts pointing at something often ignored when discussing REST, but could be formally defined. This led me to try to model REST user-agents using some kind of a state machine. I soon found out there are lots of <a href="http://portal.acm.org/citation.cfm?id=267955&amp;dl=ACM&amp;coll=GUIDE&amp;CFID=84620683&amp;CFTOKEN=34066621" target="_blank">interesting</a> <strong><a href="http://webpages.cs.luc.edu/~laufer/papers/isas95.pdf" target="_blank">papers</a> <a href="ieeexplore.ieee.org/iel5/10670/33674/01602332.pdf?arnumber=1602332 " target="_blank">on</a> <a href="http://portal.acm.org/citation.cfm?id=366869&amp;dl=GUIDE&amp;coll=GUIDE&amp;CFID=84620229&amp;CFTOKEN=91600605" target="_blank">modeling </a><a href="http://portal.acm.org/citation.cfm?id=267449" target="_blank">hypermedia</a> <a href="http://www.cs.auckland.ac.nz/compsci345s1c/lectures/formcharts.pdf" target="_blank">applications</a></strong><strong> in general</strong> and <a href="http://intertwingly.net/blog/2005/03/09/Distributed-State-Machines" target="_blank">even</a> <a href="http://weblogs.java.net/blog/2007/04/27/rest-state-machine-duh" target="_blank">more</a> <strong><a href="http://www.pluralsight-training.net/community/blogs/tewald/archive/2007/04/26/46984.aspx" target="_blank">blogs</a> on modeling REST user-agents</strong> using some kind of state machine formalism (<a href="http://en.wikipedia.org/wiki/Finite_state_machine" target="_blank">FSMs</a>, <a href="http://en.wikipedia.org/wiki/UML_state_machine" target="_blank">statecharts</a>, <a href="http://en.wikipedia.org/wiki/Petri_net" target="_blank">Petri nets</a> or something else). Here are some of my thoughts after reading these papers and blogs:</p>
<ol style="text-align:justify;">
<li style="text-align:justify;">Most often, models are based on the &#8220;each page is a state and each link is a state transition&#8221; analogy. This is confusing and wrong for two reasons. First, it&#8217;s confusing since resource identifiers (e.g. URIs) are used to somehow address states of the application (e.g. an URI addresses a page which is mapped to a state) and state transitions (e.g. an URI is a link to a state which is mapped to a transition). In REST, resource identifiers are neither the single thing determining the state (e.g. two clients can perform the same GET request on a resource and get different representations which determine state) nor the single thing determining the transition between states (e.g. one client can perform a GET on a resource, the other could perform a PUT). Roy&#8217;s thesis defines what constitutes application state and thus when the state changes: &#8220;<em>An application&#8217;s state is therefore defined by its pending requests, the topology of connected components, the active requests on those connectors, the data flow of representations in response to those requests, and the processing of those representations as they are received by the user agent.</em>&#8221; Second, models often ignore some REST concepts like steady and transient states and are therefore useful only for understanding REST up to a certain level.</li>
<li>State machines models are extremely simple to understand and a powerful tool for modeling. For example, state machines can also be used for <a href="http://en.wikipedia.org/wiki/Model_checking" target="_blank">model checking</a> using <a href="http://en.wikipedia.org/wiki/Temporal_logic" target="_blank">temporal logic</a> (e.g. check that from any state there is a link to the home page).</li>
</ol>
<p style="text-align:justify;">That&#8217;s why I really like Stu Charlton&#8217;s <a href="http://www.stucharlton.com/blog/archives/2010/03/building-a-restful-hypermedia.html" target="_blank">recent post</a> on RESTful user-agents which identifies different types of state machines involved in user-agent operation. Stu nailed most of the things I wanted to write about, but nevertheless &#8211; below is my first attempt at a simplified finite state machine (FSM) model of RESTful user-agents. I won&#8217;t go into explaining FSMs in detail, so just check the <a href="http://en.wikipedia.org/wiki/Finite_state_machine" target="_blank">Wikipedia article</a> if you don&#8217;t know what FSMs are.</p>
<p style="text-align:justify;">I&#8217;ll concentrate on recognizer-type finite state machines &#8211; specifically, <a href="http://en.wikipedia.org/wiki/Nondeterministic_finite-state_machine" target="_blank">nondeterministic FSMs (NFAs)</a>. NFAs are mathematically defined as a quintuple (Σ,<em>S</em>,<em>s</em><sub>0</sub>,δ,<em>F</em>), where</p>
<ul style="text-align:justify;">
<li><span class="texhtml"><em>Σ</em></span> is the input <span style="color:#000000;">alphabet</span> (a finite, non-empty set of symbols).</li>
<li><span class="texhtml"><em>S</em></span> is a finite, non-empty set of states.</li>
<li><span class="texhtml"><em>s</em><sub><span style="font-size:medium;"><em>0</em></span></sub></span> is an initial state, an element of <span class="texhtml"><em>S</em></span>.</li>
<li><span class="texhtml"><em>δ</em></span> is the state-transition function: <em>δ : S x Σ → P(S)</em> where <em>P(S)</em> the power set <em>S</em>.</li>
<li><span class="texhtml"><em>F</em></span> is the set of final states, a subset of <span class="texhtml"><em>S</em></span>.</li>
</ul>
<p style="text-align:justify;">The operation of an NFA automaton, as state machines are sometimes called, is described as follows. The NFA starts from the initial state and then sequentially reads one input symbol at a time each time applying the state-transition function to transfer itself to the next state. After all input symbols have been processed in this way, the NFA stops and outputs &#8220;true&#8221; if the last state is in the set of final states, or &#8220;false&#8221; otherwise. Notice that it is not defined how input symbols are generated, just that there is a sequence of them being fed to the automaton. Also notice that NFAs can nondeterministically transfer to a set of states at some point. This <strong>nondeterminism is important but also confusing</strong> &#8211; how can the automaton be at more than a single state? Well, although the formal definition indicates that the automaton is in a set of states, the practical and useful meaning is that the automaton may be at any single state from that set &#8211; we don&#8217;t know which one in advance, it can be any single one. In other words, a single state from the set will be chosen in some way e.g. using probabilities.</p>
<p style="text-align:justify;">This iterative process of automaton operation can be modeled as a system:</p>
<table>
<tbody>
<tr>
<td>
<pre>CurrentState = s<sub>0</sub></pre>
<pre><sub>while there are more input symbols to process:</sub></pre>
<pre>  InputSymbol = GetNextInput()</pre>
<pre>  CurrentState =
    TransitionFunction(InputSymbol, CurrentState)</pre>
</td>
<td><img loading="lazy" data-attachment-id="477" data-permalink="https://izuzak.wordpress.com/2010/04/03/why-understanding-rest-is-hard-and-what-we-should-do-about-it-systematization-models-and-terminology-for-rest/sdcqsv__tpdzju-h_mxjqtw-3/" data-orig-file="https://izuzak.wordpress.com/wp-content/uploads/2010/04/sdcqsv__tpdzju-h_mxjqtw-3.png" data-orig-size="600,246" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="sdcQSv__tPdzJu-H_MxJqTw (3)" data-image-description="" data-image-caption="" data-large-file="https://izuzak.wordpress.com/wp-content/uploads/2010/04/sdcqsv__tpdzju-h_mxjqtw-3.png?w=600" class="aligncenter size-full wp-image-477" style="margin:5px;" title="sdcQSv__tPdzJu-H_MxJqTw (3)" src="https://izuzak.wordpress.com/wp-content/uploads/2010/04/sdcqsv__tpdzju-h_mxjqtw-3.png?w=720" alt=""   srcset="https://izuzak.wordpress.com/wp-content/uploads/2010/04/sdcqsv__tpdzju-h_mxjqtw-3.png?w=300&amp;h=123 300w, https://izuzak.wordpress.com/wp-content/uploads/2010/04/sdcqsv__tpdzju-h_mxjqtw-3.png?w=150&amp;h=62 150w, https://izuzak.wordpress.com/wp-content/uploads/2010/04/sdcqsv__tpdzju-h_mxjqtw-3.png 600w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p style="text-align:left;">&nbsp;</p>
</td>
</tr>
</tbody>
</table>
<p style="text-align:justify;">Here, CurrentState is a component that stores the current state of the automaton, InputSymbol is a component that stores the current input symbol (element from the input alphabet), GetNextInput is a component that provides the next input symbol and writes it to the InputSymbol component and TransitionFunction is a component that computes the state transition function and writes the new state to the CurrentState component. Notice that the GetNextInput component doesn&#8217;t take any input in this description. This is not entirely true, of course &#8211; the operation of the component that generates input symbols is out of scope of formal automaton definition, the component may generate input symbols based on whatever it wants. So, I&#8217;ll expand the system to include the CurrentState as an input to the GetNextInput component (since there is nothing else in the model to include):</p>
<table>
<tbody>
<tr>
<td>
<pre>CurrentState = s<sub>0</sub></pre>
<pre><sub>while there are more input symbols to process:</sub></pre>
<pre>  InputSymbol = GetNextInput(<span style="color:#ff0000;">CurrentState</span>)</pre>
<pre>  CurrentState =
    TransitionFunction(InputSymbol, CurrentState)</pre>
</td>
<td>
<p style="text-align:center;"><img loading="lazy" data-attachment-id="441" data-permalink="https://izuzak.wordpress.com/2010/04/03/why-understanding-rest-is-hard-and-what-we-should-do-about-it-systematization-models-and-terminology-for-rest/sdcqsv__tpdzju-h_mxjqtw/" data-orig-file="https://izuzak.wordpress.com/wp-content/uploads/2010/04/sdcqsv__tpdzju-h_mxjqtw.png" data-orig-size="600,246" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="sdcQSv__tPdzJu-H_MxJqTw" data-image-description="" data-image-caption="" data-large-file="https://izuzak.wordpress.com/wp-content/uploads/2010/04/sdcqsv__tpdzju-h_mxjqtw.png?w=600" class="aligncenter size-full wp-image-441" style="margin:5px;" title="sdcQSv__tPdzJu-H_MxJqTw" src="https://izuzak.wordpress.com/wp-content/uploads/2010/04/sdcqsv__tpdzju-h_mxjqtw.png?w=720" alt=""   srcset="https://izuzak.wordpress.com/wp-content/uploads/2010/04/sdcqsv__tpdzju-h_mxjqtw.png?w=300&amp;h=123 300w, https://izuzak.wordpress.com/wp-content/uploads/2010/04/sdcqsv__tpdzju-h_mxjqtw.png?w=150&amp;h=62 150w, https://izuzak.wordpress.com/wp-content/uploads/2010/04/sdcqsv__tpdzju-h_mxjqtw.png 600w" sizes="(max-width: 300px) 100vw, 300px" /></p>
</td>
</tr>
</tbody>
</table>
<p style="text-align:justify;">Now the interesting part &#8211; <strong>mapping properties of RESTful user-agents to this NFA model</strong>. As I wrote before, this is a simplified first-draft-quality model, not everything that should be included is included and thus the model may change when more details do get included. First I&#8217;ll try to explain the mapping in a general way, not on a specific RESTful system, and after that I&#8217;ll give a concrete example:</p>
<ul>
<li style="text-align:justify;"><strong>The input alphabet</strong> (set of input symbols generated by the GetNextInput component and stored in the InputSymbol component) are REST requests. Since a REST requests is defined by a resource identifier, method to be performed on the resource, metadata and a possible representation, the input alphabet is the set of all possible (syntactically) well-formed REST requests. This is why the resource identifier is not the only thing representing a transition &#8211; a single transition from a specific state is defined by all elements of a REST request, only one of which is the resource identifier. Therefore, there may be multiple transitions from a specific state and a specific destination resource identifier.</li>
<li style="text-align:justify;"><span style="font-size:13.1944px;"><strong>The state transition function</strong>, implemented in the TransitionFunction component, is the cumulative processing of REST requests. This process is performed by user-agents, intermediaries and origin servers, and the result is a REST response containing metadata and a representation of the resource identified in the related REST request. Here&#8217;s the most important part &#8211; since the user-agent doesn&#8217;t know what the response to a request will be and since the origin server may return different REST responses for the same REST request &#8211; this processing must be modeled as nondeterministic. In other words, the result of the transition function is a set of all possible REST responses which may be returned for a given REST request. As I explained earlier when demystifying nondeterminism, the origin server will in fact return a single response but since we don&#8217;t know which one &#8211; this is modeled as a set of possible responses. Also, the metadata (media type) of the response defines if the state is steady or not by specifying which of the resources linked to from the response representation should also be requested. If the state is not steady, more requests should be sent for those resources. If the input symbol is a REST request for a resource for which there is no link in the current state then the transition function returns an empty set. The same happens if the system is not in a steady state and the input symbol is a REST request not in the set of pending requests.</span></li>
<li style="text-align:justify;"><strong>The current state</strong>, stored in the CurrentState component, is a set of REST responses and pending REST requests. The current state is considered a steady state if there are no pending requests, otherwise it&#8217;s considered a transient state. <strong>The initial state</strong> of the user-agent is steady and may contain a predefined representation with links to bootstrap the operation of the user-agent.</li>
<li style="text-align:justify;">The only thing left is to define how the user-agent chooses transitions &#8211; the next REST request for the current state. This is the role of the GetNextInput component which implements both application- and hypermedia-level logic. The application-level logic is in charge of generating input symbols in case the current state is steady, or in other words, it chooses then next step for achieving the overall application goal. The application-level logic may be a software program or a program that delegates this responsibility to a human user. The hypermedia-level logic is in charge of generating input symbols in case the current state is transient, or in other words, it chooses which of the pending REST requests will be processed next. To satisfy the HATEOAS constraint, both the application- and hypermedia- level logic generate REST requests with resource identifiers linked to from the current state.</li>
</ul>
<p style="text-align:center;"><img loading="lazy" data-attachment-id="448" data-permalink="https://izuzak.wordpress.com/2010/04/03/why-understanding-rest-is-hard-and-what-we-should-do-about-it-systematization-models-and-terminology-for-rest/sqzco1asqqa8kmx6twyqztg-1/" data-orig-file="https://izuzak.wordpress.com/wp-content/uploads/2010/04/sqzco1asqqa8kmx6twyqztg-1.png" data-orig-size="600,383" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="sQZcO1aSqqA8Kmx6TWYqzTg (1)" data-image-description="" data-image-caption="" data-large-file="https://izuzak.wordpress.com/wp-content/uploads/2010/04/sqzco1asqqa8kmx6twyqztg-1.png?w=600" class="size-full wp-image-448 aligncenter" style="margin-top:5px;margin-bottom:5px;" title="sQZcO1aSqqA8Kmx6TWYqzTg (1)" src="https://izuzak.wordpress.com/wp-content/uploads/2010/04/sqzco1asqqa8kmx6twyqztg-1.png?w=720" alt=""   srcset="https://izuzak.wordpress.com/wp-content/uploads/2010/04/sqzco1asqqa8kmx6twyqztg-1.png 600w, https://izuzak.wordpress.com/wp-content/uploads/2010/04/sqzco1asqqa8kmx6twyqztg-1.png?w=150&amp;h=96 150w, https://izuzak.wordpress.com/wp-content/uploads/2010/04/sqzco1asqqa8kmx6twyqztg-1.png?w=300&amp;h=192 300w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<p>Or mathematically (without all the detailed explanations):</p>
<ul style="text-align:justify;">
<li><span class="texhtml"><em>Σ</em></span> = { <em>R</em> | <em>R</em> is a valid REST request consisting of a resource identifier, method, metadata and representation }</li>
<li><span class="texhtml"><em>S</em></span> = { { <em>G</em> } | <em>G</em> is a valid REST response consisting of metadata and a representation or a pending REST request }</li>
<li><span class="texhtml"><em>s</em><sub><span style="font-size:medium;"><em>0</em></span></sub></span> = initial representation containing links to bootstrap the operation of the user agent</li>
<li><em>δ : S x Σ → P(S)</em> where <em>P(S)</em> the power set of <em>S</em>.</li>
<li><span class="texhtml"><em>F</em></span> = { <em>Z</em> | <em>Z</em> ∈ <em>S</em> and <em>Z</em> is a steady state }</li>
</ul>
<p style="text-align:justify;">The operation of the automaton can be described as follows. The automaton starts from the initial steady state containing links for bootstrapping the application. Each time the automaton is in a steady state, the application level logic generates the next input symbol (request) based on the links in the current state representations and the overall application goal. The request and the current state are used by the processing infrastructure (user-agent, intermediaries, origin server) to generate a response. Notice here that the current state (representation already on the client) need not be sent to the server, it may be used on the user-agent for processing (e.g. to determine if the request is for a resource linked to from the current state or not) while only the input symbol (the request) is sent over the network. The result of the processing is the new state of the user-agent. The new state may either be steady or transient, based on the representation received in the response and it&#8217;s metadata (media type). If the state is transient, the hypermedia-level logic automatically chooses requests for fetching other resources in order to bring the user-agent into a steady state so that application-level logic can take over.</p>
<p><img loading="lazy" data-attachment-id="453" data-permalink="https://izuzak.wordpress.com/2010/04/03/why-understanding-rest-is-hard-and-what-we-should-do-about-it-systematization-models-and-terminology-for-rest/seelaffckhtless1-yj-sgq/" data-orig-file="https://izuzak.wordpress.com/wp-content/uploads/2010/04/seelaffckhtless1-yj-sgq.png" data-orig-size="600,505" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="sEelafFcKhTLEsS1-yJ-SGQ" data-image-description="" data-image-caption="" data-large-file="https://izuzak.wordpress.com/wp-content/uploads/2010/04/seelaffckhtless1-yj-sgq.png?w=600" class="aligncenter size-full wp-image-453" title="sEelafFcKhTLEsS1-yJ-SGQ" src="https://izuzak.wordpress.com/wp-content/uploads/2010/04/seelaffckhtless1-yj-sgq.png?w=720" alt=""   /></p>
<p style="text-align:justify;">Now an <strong>example &#8211; applying this model to a specific RESTful system</strong>, which will of course be a simple web application shown above. The purpose of the web application is to simulate coin tossing. It has two web pages, <em>Main.html</em> and <em>Cointoss.html</em>. The <em>Main.html</em> page contains only a single link to the <em>Cointoss.html</em> page and nothing else. The <em>Cointoss.html</em> page has a link back to the <em>Main.html</em> page and a single image. Since the web application simulates coin tossing, which is nondeterministic, the image which gets included into the <em>Cointoss.html</em> is chosen randomly by the server and is either the <em>heads.png</em> image or the <em>tails.png</em> image.</p>
<p style="text-align:justify;">The input symbols of the resulting automaton are requests for fetching application resources &#8211; the html pages and the images. The states of the resulting automaton are both steady states representing a complete page load or transient states representing partial page loads. Therefore, the <em>Main.html</em> page is represented by only a steady state since it only contains a link to <em>Cointoss.html</em>, while the <em>Cointoss.html</em> page is represented by both a transient state and a steady state since it contains an image which must be fetched after the initial page. Let&#8217;s assume that the initial state contains a single link to the <em>Main.html</em> page. The transition function of the resulting automaton defines which responses the processing infrastructure returns for each state and requests. Therefore, if the user-agent requests a page or image, the server returns the requested page or image. However, if the user-agent is requesting the <em>Cointoss.html</em> page &#8211; it isn&#8217;t known in advance what the server will return (heads or tails), so we need a nondeterministic transition into two possible states. Lastly, steady states define the set of acceptable states.</p>
<p style="text-align:justify;">And here&#8217;s the formal automaton definition for the explanation above:</p>
<ul style="text-align:justify;">
<li><span class="texhtml"><em>Σ</em></span> = { <em>R1</em>, <em>R2</em>, <em>R3</em>, <em>R4</em> }, where <em>R1</em> is a request for fetching <em>Main.html</em>, <em>R2</em> is a request for fetching <em>Cointoss.html</em>, and <em>R3</em> and <em>R4</em> are requests for fetching the <em>heads.png</em> and <em>tails.png</em> images. For simplicity, let&#8217;s say these are the only input symbols the user-agent may generate, but in general &#8211; it may generate other syntactically valid requests.</li>
<li><span class="texhtml"><em>S</em></span> = { <em>S1</em>, <em>S2</em>, <em>S3</em>, <em>S4</em>, <em>S5</em>, <em>S6</em>}, where <em>S1</em> is the initial state containing a link to <em>Main.html</em>, <em>S2 </em>is the state after receiving the <em>Main.html</em> page, <em>S3 </em>is the state after receiving the <em>Cointoss.html</em> page which has a link to the <em>heads.png</em> image which hasn&#8217;t been fetched yet, <em>S4</em> is the state after receiving responses to both the <em>Cointoss.html</em> page and <em>heads.pn</em>g, <em>S5 </em>is the state after receiving the <em>Cointoss.html</em> page which has a link to the <em>tails.png</em> image which hasn&#8217;t been fetched yet and <em>S6 <span style="font-style:normal;">is the state after receiving responses to both the <em>Cointoss.html</em> page and <em>tails.pn</em>g.</span></em></li>
<li><span class="texhtml"><em>s</em><sub><span style="font-size:medium;"><em>0</em></span></sub></span> = <em>S1</em>, since <em>S1</em> is the initial state.</li>
<li>The transition function is defined for each pair of automaton state and input symbol: <em>δ</em>(<em>S1</em>, <em>R1</em>) = <em>S2</em>, <em>δ</em>(<em>S2</em>, <em>R2</em>) = {<em>S3</em>,<em> S5</em>}<em>,</em> <em>δ</em>(<em>S3</em>, <em>R3</em>) = <em>S4</em>, <em>δ</em>(<em>S4</em>, <em>R1</em>) = <em>S2</em>, <em>δ</em>(<em>S5</em>, <em>R4</em>) = <em>S6</em>, <em>δ</em>(<em>S6</em>, <em>R1</em>) = <em>S2. </em>For other pairs of state and input symbol the function returns an empty set { } since there are no other links for those pages (states) to resources identified in those requests (input symbols).</li>
<li><span class="texhtml"><em>F</em></span> = { <em>S1</em>,<em> S2</em>,<em> S4</em>,<em> S6</em> }, since those states are steady.</li>
</ul>
<p>And here&#8217;s the equivalent state diagram visualization of the automaton:</p>
<p style="text-align:center;">&nbsp;</p>
<p><span style="font-size:13.1944px;"><img loading="lazy" data-attachment-id="458" data-permalink="https://izuzak.wordpress.com/2010/04/03/why-understanding-rest-is-hard-and-what-we-should-do-about-it-systematization-models-and-terminology-for-rest/sm1g93hkrlikxr3whry-lq-2/" data-orig-file="https://izuzak.wordpress.com/wp-content/uploads/2010/04/sm1g93hkrlikxr3whry-lq-2.png" data-orig-size="900,472" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="sm1G93HkrliKXr3WHRy&amp;#8211;lQ (2)" data-image-description="" data-image-caption="" data-large-file="https://izuzak.wordpress.com/wp-content/uploads/2010/04/sm1g93hkrlikxr3whry-lq-2.png?w=720" class="aligncenter size-full wp-image-458" title="sm1G93HkrliKXr3WHRy--lQ (2)" src="https://izuzak.wordpress.com/wp-content/uploads/2010/04/sm1g93hkrlikxr3whry-lq-2.png?w=720&#038;h=377" alt="" width="720" height="377" srcset="https://izuzak.wordpress.com/wp-content/uploads/2010/04/sm1g93hkrlikxr3whry-lq-2.png?w=720&amp;h=378 720w, https://izuzak.wordpress.com/wp-content/uploads/2010/04/sm1g93hkrlikxr3whry-lq-2.png?w=150&amp;h=79 150w, https://izuzak.wordpress.com/wp-content/uploads/2010/04/sm1g93hkrlikxr3whry-lq-2.png?w=300&amp;h=157 300w, https://izuzak.wordpress.com/wp-content/uploads/2010/04/sm1g93hkrlikxr3whry-lq-2.png?w=768&amp;h=403 768w, https://izuzak.wordpress.com/wp-content/uploads/2010/04/sm1g93hkrlikxr3whry-lq-2.png 900w" sizes="(max-width: 720px) 100vw, 720px" /></span></p>
<p>For such a model, we could generate a random sequence of input symbols and check if the automaton will end up in a steady state or not. You can do this for homework :).</p>
<h2>Conclusion</h2>
<p style="text-align:justify;">(<strong><em>EDIT: inserted a few sentences to make this a real conclusion</em></strong>) That&#8217;s about it. All-in-all, I think REST is an important concept for the WWW and that more work should be done to explain it fully and concisely. After that, we can simplify the models to reflect the most important properties, but simplifying before understanding leads to ignorance and <em>mis</em>understanding in discussions.</p>
<p style="text-align:justify;">If you have ideas or comments about systematizing knowledge, terminology and models for REST or developing formal models for REST &#8211; let me know. <a href="http://www.twitter.com/izuzak" target="_blank">@izuzak</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://izuzak.wordpress.com/2010/04/03/why-understanding-rest-is-hard-and-what-we-should-do-about-it-systematization-models-and-terminology-for-rest/feed/</wfw:commentRss>
			<slash:comments>12</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">190</post-id>
		<media:content medium="image" url="https://1.gravatar.com/avatar/db8f5d658a8f5bfd6ed0442054eb545bfa58ae59aabb92e6495f372966d0d3de?s=96&amp;d=https%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96">
			<media:title type="html">izuzak</media:title>
		</media:content>

		<media:content medium="image" url="http://farm4.static.flickr.com/3175/2918889380_994055f2f9_b.jpg"/>

		<media:content medium="image" url="http://www.codeproject.com/KB/aspnet/NoteOnWebApplications/Figure2.gif"/>

		<media:content medium="image" url="http://images.ctv.ca/archives/CTVNews/img2/20080516/450_messy1_080516.jpg"/>

		<media:content medium="image" url="http://farm4.static.flickr.com/3199/3330670980_dab9f6b5c8.jpg"/>

		<media:content medium="image" url="https://izuzak.wordpress.com/wp-content/uploads/2010/04/sdcqsv__tpdzju-h_mxjqtw-3.png">
			<media:title type="html">sdcQSv__tPdzJu-H_MxJqTw (3)</media:title>
		</media:content>

		<media:content medium="image" url="https://izuzak.wordpress.com/wp-content/uploads/2010/04/sdcqsv__tpdzju-h_mxjqtw.png">
			<media:title type="html">sdcQSv__tPdzJu-H_MxJqTw</media:title>
		</media:content>

		<media:content medium="image" url="https://izuzak.wordpress.com/wp-content/uploads/2010/04/sqzco1asqqa8kmx6twyqztg-1.png">
			<media:title type="html">sQZcO1aSqqA8Kmx6TWYqzTg (1)</media:title>
		</media:content>

		<media:content medium="image" url="https://izuzak.wordpress.com/wp-content/uploads/2010/04/seelaffckhtless1-yj-sgq.png">
			<media:title type="html">sEelafFcKhTLEsS1-yJ-SGQ</media:title>
		</media:content>

		<media:content medium="image" url="https://izuzak.wordpress.com/wp-content/uploads/2010/04/sm1g93hkrlikxr3whry-lq-2.png">
			<media:title type="html">sm1G93HkrliKXr3WHRy--lQ (2)</media:title>
		</media:content>
	<enclosure length="848338" type="application/pdf" url="http://www.vs.inf.ethz.ch/res/papers/dguinard_09_WOTMashups.pdf"/><itunes:explicit>no</itunes:explicit><itunes:subtitle>This blog has moved to a new domain. You can view this post here. This is going to be another long post, so I&amp;#8217;m using the introduction as an overview again. Introduction This post is about understanding REST, the software architectural style behind the World Wide Web. My Ph.D. research, which I&amp;#8217;ll write about some [&amp;#8230;]</itunes:subtitle><itunes:summary>This blog has moved to a new domain. You can view this post here. This is going to be another long post, so I&amp;#8217;m using the introduction as an overview again. Introduction This post is about understanding REST, the software architectural style behind the World Wide Web. My Ph.D. research, which I&amp;#8217;ll write about some [&amp;#8230;]</itunes:summary><itunes:keywords>web development, architectural styles, architecture, automata, collaboration, comunity, finite state machine, formal model, FSM, hypermedia, model, NFA, nondeterministic, REST, software, web, WWW</itunes:keywords></item>
		<item>
		<title>Real-time feed processing and filtering</title>
		<link>https://izuzak.wordpress.com/2010/01/11/real-time-feed-processing-and-filtering/</link>
					<comments>https://izuzak.wordpress.com/2010/01/11/real-time-feed-processing-and-filtering/#comments</comments>
		
		<dc:creator><![CDATA[Ivan Zuzak]]></dc:creator>
		<pubDate>Mon, 11 Jan 2010 12:54:54 +0000</pubDate>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[appengine]]></category>
		<category><![CDATA[atom]]></category>
		<category><![CDATA[ecosystems]]></category>
		<category><![CDATA[end-users]]></category>
		<category><![CDATA[feedbuster]]></category>
		<category><![CDATA[feeds]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[filtering]]></category>
		<category><![CDATA[friendfeed]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[polling]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[processing]]></category>
		<category><![CDATA[pshb]]></category>
		<category><![CDATA[pubsubhubbub]]></category>
		<category><![CDATA[push]]></category>
		<category><![CDATA[real-time]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[rsscloud]]></category>
		<category><![CDATA[scalability]]></category>
		<category><![CDATA[services]]></category>
		<category><![CDATA[syndication]]></category>
		<guid isPermaLink="false">http://izuzak.wordpress.com/?p=169</guid>

					<description><![CDATA[This post is about web syndication feeds (RSS and ATOM), technologies for real-time delivery of feeds (PubSubHubBub, RSSCloud) and two opportunities I believe could help make these technologies better and widen their adoption: real-time feed processing/filtering and end-user selection of processing/filtering services. First, I'll write about my experience with polling-based feed processing services from developing Feed-buster, a feed-enhancing service for use in FriendFeed. Next, I'll give a short overview of PubSubHubBub (PSHB) and several ways of integrating feed filtering and processing functionalities into the PSHB ecosystem without changing the PSHB protocol. Lastly, I'll try to argument why there should be a better solution and outline an idea for an extension to the PSHB protocol.]]></description>
										<content:encoded><![CDATA[<p><em><strong>This blog has moved to a <a href="http://ivanzuzak.info">new domain</a>. You can view this post <a href="http://ivanzuzak.info/2010/01/11/real-time-feed-processing-and-filtering.html">here</a>. </strong></em></p>
<p>This is another lengthy post so I&#8217;m writing a brief overview as an introduction.</p>
<h2>Introduction</h2>
<p>This post is about web syndication feeds (RSS and ATOM), technologies for real-time delivery of feeds (PubSubHubBub, RSSCloud) and two opportunities I believe could help make these technologies better and widen their adoption: <strong>real-time feed processing/filtering and end-user selection of processing/filtering services</strong>. First, I&#8217;ll write about my experience with polling-based feed processing services from developing Feed-buster, a feed-enhancing service for use in FriendFeed. Next, I&#8217;ll give a short overview of PubSubHubBub (PSHB) and several ways of integrating feed filtering and processing functionalities into the PSHB ecosystem without changing the PSHB protocol. Lastly, I&#8217;ll try to argument why there should be a better solution and outline an idea for an extension to the PSHB protocol.</p>
<p>Before I continue, I have to acknowledge that I&#8217;ve discussed some of these ideas with <a href="http://twitter.com/julien51" target="_blank">Julien </a><a href="http://twitter.com/julien51" target="_blank">Genestoux</a> (the guy behind <a href="http://superfeedr.com/" target="_blank">Superfeedr</a>) and <a href="http://www.google.com/profiles/bslatkin" target="_blank">Brett </a><a href="http://www.google.com/profiles/bslatkin" target="_blank">Slatkin</a> (one of <a href="http://code.google.com/p/pubsubhubbub/" target="_blank">PSHB</a> developers) several months ago. Julien and I were even starting to draft a proposal for a PSHB extension for supporting filters, however, due to other stuff in our lives, we didn&#8217;t really get anywhere.</p>
<h2>Polling-based feed processing and filtering &#8211; experience from FriendFeed and Feed-Buster</h2>
<p><a href="http://friendfeed.com/" target="_blank">FriendFeed</a> is a social-networking web application that aggregates updates from social media sites and blogs that expose an <a href="http://en.wikipedia.org/wiki/RSS" target="_blank">RSS</a> or <a href="http://en.wikipedia.org/wiki/Atom_feed" target="_blank">Atom</a> feed of their content. You give FriendFeed the URI of an RSS/Atom feed and it fetches and displays short snippets of updates as they appear in the feed. In most cases this means that only the title and a short snippet of the description of the new item are shown. For feeds that have <a href="http://en.wikipedia.org/wiki/Media_RSS" target="_blank">special XML tags</a> that list media resources in the update, the images/videos/audio content from the new feed item is also displayed. The problem is that <strong>most RSS/Atom feeds don&#8217;t have these media XML tags </strong>since webapps that create the feeds (e.g. blogging engines) don&#8217;t bother defining them. This gave a not-very-user-friendly look to most FriendFeed user pages which were just a long list of update titles and possibly snippets.</p>
<div data-shortcode="caption" id="attachment_292" style="width: 310px" class="wp-caption aligncenter"><a href="http://code.google.com/p/feed-buster/" target="_blank"><img aria-describedby="caption-attachment-292" loading="lazy" data-attachment-id="292" data-permalink="https://izuzak.wordpress.com/2010/01/11/real-time-feed-processing-and-filtering/fbdemopic/" data-orig-file="https://izuzak.wordpress.com/wp-content/uploads/2010/01/fbdemopic.png" data-orig-size="1387,829" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="fbDemoPic" data-image-description="" data-image-caption="" data-large-file="https://izuzak.wordpress.com/wp-content/uploads/2010/01/fbdemopic.png?w=720" class="size-medium wp-image-292" title="Feed-buster" src="https://izuzak.wordpress.com/wp-content/uploads/2010/01/fbdemopic.png?w=300&#038;h=180" alt="Feed-buster"   srcset="https://izuzak.wordpress.com/wp-content/uploads/2010/01/fbdemopic.png?w=300 300w, https://izuzak.wordpress.com/wp-content/uploads/2010/01/fbdemopic.png?w=450 450w, https://izuzak.wordpress.com/wp-content/uploads/2010/01/fbdemopic.png?w=900 900w, https://izuzak.wordpress.com/wp-content/uploads/2010/01/fbdemopic.png?w=150 150w, https://izuzak.wordpress.com/wp-content/uploads/2010/01/fbdemopic.png?w=768 768w" sizes="(max-width: 450px) 100vw, 450px" /></a><p id="caption-attachment-292" class="wp-caption-text">Feed-buster</p></div>
<p>So I built <a href="http://code.google.com/p/feed-buster/" target="_blank"><strong>Feed-buster</strong></a><strong>, an </strong><a href="http://code.google.com/appengine/" target="_blank"><strong>AppEngine</strong></a><strong> service that inserts these MediaRSS tags into feeds that don&#8217;t have them</strong>. Since the only thing FriendFeed accepts from users are URIs pointing to feeds &#8211; the service must be callable by requesting a single URI with a HTTP GET request and must return an RSS/Atom feed in a HTTP response. Here&#8217;s how Feed-buster works:</p>
<ol>
<li>An URI to an RSS/Atom feed is supplied as a query parameter of a HTTP GET request to the service. E.g. <a href="http://feed-buster.appspot.com/mediaInjection?inputFeedUrl=http://myfeed.com/atom" rel="nofollow">http://feed-buster.appspot.com/mediaInjection?inputFeedUrl=http://myfeed.com/atom</a>.</li>
<li>The service fetches the target feed, finds all the images, video and audio URIs and inserts the special XML tags for each one back into the feed.</li>
<li>The service returns the modified feed as the content of a HTTP response.</li>
</ol>
<p>To use the service, the user would obtain an URI of an RSS/Atom feed, create the corresponding Feed-buster URI by appending the feed URI to the Feed-buster service URI and pass it to FriendFeed (1). Suppose that the feed is not real-time enabled (i.e. a PSHB or RSSCloud feed). In this case, every 45 minutes FF will poll for updates &#8211; send a HTTP GET request to the service (2), the service will fetch the original feed (3), process the feed (4) and return a HTTP response with the processed feed (5).</p>
<div data-shortcode="caption" id="attachment_299" style="width: 310px" class="wp-caption aligncenter"><img aria-describedby="caption-attachment-299" loading="lazy" data-attachment-id="299" data-permalink="https://izuzak.wordpress.com/2010/01/11/real-time-feed-processing-and-filtering/fb/" data-orig-file="https://izuzak.wordpress.com/wp-content/uploads/2010/01/fb.png" data-orig-size="1262,562" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="FB" data-image-description="" data-image-caption="" data-large-file="https://izuzak.wordpress.com/wp-content/uploads/2010/01/fb.png?w=720" class="size-medium wp-image-299" title="Feed-buster architecture" src="https://izuzak.wordpress.com/wp-content/uploads/2010/01/fb.png?w=300&#038;h=133" alt="Feed-buster architecture"   srcset="https://izuzak.wordpress.com/wp-content/uploads/2010/01/fb.png?w=300 300w, https://izuzak.wordpress.com/wp-content/uploads/2010/01/fb.png?w=540 540w, https://izuzak.wordpress.com/wp-content/uploads/2010/01/fb.png?w=1080 1080w, https://izuzak.wordpress.com/wp-content/uploads/2010/01/fb.png?w=150 150w, https://izuzak.wordpress.com/wp-content/uploads/2010/01/fb.png?w=768 768w, https://izuzak.wordpress.com/wp-content/uploads/2010/01/fb.png?w=1024 1024w" sizes="(max-width: 540px) 100vw, 540px" /><p id="caption-attachment-299" class="wp-caption-text">Feed-buster architecture</p></div>
<p>Feed-buster is a<strong> feed processing service</strong>: it takes a feed URI as input and returns the feed it points to as output, potentially modifying any subset of feed items (but not removing any). <strong>Feed filtering services</strong> are similar: they take a feed URI as input and return the feed it points to as output, potentially removing any subset of feed items (but not modifying any). The difference is subtle and both terms could be unified under &#8220;feed processing&#8221;. Furthermore, this model of feed processing/filtering was nothing new at the time I developed Feed-buster, there were <a href="http://www.readwriteweb.com/archives/6_ways_to_filter_your_rss_feeds.php" target="_blank">numerous services</a> that filtered/processed feeds based on user preferences. The best example is probably <a href="http://pipes.yahoo.com/pipes/" target="_blank"><strong>Yahoo! Pipes</strong></a><strong> which enables anyone to create a filtering/processing pipe a publish it as a service</strong> just like Feed-buster.</p>
<p>Lessons learned:</p>
<ul>
<li>Feed-buster is very <strong>simple to use</strong> and this helped to make it popular (appending an URI to another URI is something everyone can do).</li>
<li>Feed-buster&#8217;s model of use is based on <strong>separation of filtering/processing services as individual entities in the ecosystem</strong> which enables that these services be developed independently of publishers and subscribers. Applications that enable other applications make ecosystems grow.</li>
<li>Polling is bad (1). Because AppEngine applications have a <a href="http://code.google.com/appengine/docs/quotas.html" target="_blank">fixed free daily quota</a> for consumed resources, when the number of feeds the service processed increased &#8211;<strong> the daily quota was exhausted before the end of the day</strong> because FF polls the service for each feed every 45 minutes. See the AppEngine resource graph below for a very clear visual explanation :). Of course, I implemented several caching mechanisms in the service and it helped, but not enough.</li>
<li>Polling is bad (2). Real-time feed delivery arrived in the form of <a href="http://code.google.com/p/pubsubhubbub/" target="_blank">PubSubHubBub</a> and <a href="http://rsscloud.org/" target="_blank">RSSCloud</a>, <strong>everyone loved it and wanted everything to be real-time</strong>. But Feed-buster feeds weren&#8217;t real-time. Even if the original feed supported PSHB, the output feed didn&#8217;t (since it Feed-buster wasn&#8217;t a PSHB publisher or hub). Feed-buster users were not happy.</li>
</ul>
<div data-shortcode="caption" id="attachment_306" style="width: 586px" class="wp-caption aligncenter"><a href="https://izuzak.wordpress.com/wp-content/uploads/2010/01/fbgae.png"><img aria-describedby="caption-attachment-306" loading="lazy" data-attachment-id="306" data-permalink="https://izuzak.wordpress.com/2010/01/11/real-time-feed-processing-and-filtering/fbgae/" data-orig-file="https://izuzak.wordpress.com/wp-content/uploads/2010/01/fbgae.png" data-orig-size="750,337" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="Feed-buster &amp;#8211; AppEngine request processing duration graph" data-image-description="" data-image-caption="" data-large-file="https://izuzak.wordpress.com/wp-content/uploads/2010/01/fbgae.png?w=720" class="size-full wp-image-306" title="Feed-buster - AppEngine request processing duration graph" src="https://izuzak.wordpress.com/wp-content/uploads/2010/01/fbgae.png?w=720" alt="Feed-buster - AppEngine request processing duration graph"   srcset="https://izuzak.wordpress.com/wp-content/uploads/2010/01/fbgae.png?w=576&amp;h=259 576w, https://izuzak.wordpress.com/wp-content/uploads/2010/01/fbgae.png?w=150&amp;h=67 150w, https://izuzak.wordpress.com/wp-content/uploads/2010/01/fbgae.png?w=300&amp;h=135 300w, https://izuzak.wordpress.com/wp-content/uploads/2010/01/fbgae.png 750w" sizes="(max-width: 576px) 100vw, 576px" /></a><p id="caption-attachment-306" class="wp-caption-text">Feed-buster - AppEngine request processing duration graph</p></div>
<p style="text-align:center;">&nbsp;</p>
<h2>PubSubHubBub &#8211; real-time feed delivery</h2>
<p><a href="http://code.google.com/p/pubsubhubbub/" target="_blank"><strong>PubSubHubBub</strong></a><strong> is a server-to-server publish-subscribe protocol for federated delivery of feed updates</strong>. Without going into a lot of detail, the basic architecture consists of publishers, subscribers and hubs which interact in the following way:</p>
<div id="_mcePaste">
<ol>
<li>A feed publisher declares its hub in its Atom or RSS XML file and a subscriber initially fetches the feed to discover the hub.</li>
<li>The subscriber subscribes to the discovered hub declaring the feed URI it wishes to subscribe to and an URI at which it wants to receive updates.</li>
<li>When the publisher next updates the feed, it pings the hub saying that there&#8217;s an update and the hub fetches the published feed.</li>
<li>The hub multicasts the new/changed content out to all registered subscriber.</li>
</ol>
</div>
<div data-shortcode="caption" id="attachment_308" style="width: 408px" class="wp-caption aligncenter"><a href="https://izuzak.wordpress.com/wp-content/uploads/2010/01/pshbarch.png"><img aria-describedby="caption-attachment-308" loading="lazy" data-attachment-id="308" data-permalink="https://izuzak.wordpress.com/2010/01/11/real-time-feed-processing-and-filtering/pshbarch/" data-orig-file="https://izuzak.wordpress.com/wp-content/uploads/2010/01/pshbarch.png" data-orig-size="710,192" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="PubSubHubBub ecosystem and protocol" data-image-description="" data-image-caption="&lt;p&gt;PubSubHubBub ecosystem and protocol&lt;/p&gt;
" data-large-file="https://izuzak.wordpress.com/wp-content/uploads/2010/01/pshbarch.png?w=710" class="size-full wp-image-308  " title="PubSubHubBub ecosystem and protocol" src="https://izuzak.wordpress.com/wp-content/uploads/2010/01/pshbarch.png?w=720" alt="PubSubHubBub ecosystem and protocol"   srcset="https://izuzak.wordpress.com/wp-content/uploads/2010/01/pshbarch.png?w=398&amp;h=108 398w, https://izuzak.wordpress.com/wp-content/uploads/2010/01/pshbarch.png?w=150&amp;h=41 150w, https://izuzak.wordpress.com/wp-content/uploads/2010/01/pshbarch.png?w=300&amp;h=81 300w, https://izuzak.wordpress.com/wp-content/uploads/2010/01/pshbarch.png 710w" sizes="(max-width: 398px) 100vw, 398px" /></a><p id="caption-attachment-308" class="wp-caption-text">PubSubHubBub ecosystem and protocol</p></div>
<p>And this gives us real-time feed delivery. <strong>But what about real-time filtering and processing?</strong> How would a real-time-enabled version of Feed-buster be built? Of course, there are <a href="http://blog.postrank.com/2009/10/filtering-the-real-time-web/" target="_blank">a lot more reasons for doing this</a>, both from business and engineering perspectives.</p>
<h2>Real-time feed processing and filtering (take 1)</h2>
<p>So, the idea is to <strong>extend the PSHB ecosystem with filtering/processing services in some way</strong>. First, here are a few ideas for doing this <strong>without extending the PSHB protocol</strong>:</p>
<ol>
<li><strong>Integrating filtering/processing services into publishers.</strong> This means that the publisher would expose not only the original feed, but also a feed for each filter/processing defined by the subscriber. For example, <a href="http://www.twitter.com" target="_blank">Twitter</a> has a single feed of all updates for a specific user, a feed for updates from that user containing the string &#8220;hello&#8221;, updates not containing &#8220;world&#8221;, updates written in English, and so on.</li>
<li><strong>Integrating filtering/processing services into subscribers. </strong>This means that the subscriber application would subscribe to feeds and filter/process them on it&#8217;s own. It&#8217;s not exactly the same thing but, for example, FriendFeed subscribes to feeds you want it to aggregate and later you can filter the content from within the FriendFeed application &#8212; this is called search, as in Twitter, but basically means filter.</li>
<li><strong>Integrating filtering/processing services into hubs. </strong>This means that a hub would not only deliver feed updates, but process and filter them also. This would cause a large number of hubs to be developed, each implementing some filter or processing functionality. If you want to filter a feed &#8211; subscribe to a hub that implements that filter. If you want a new filter &#8211; build a new hub. However, if an end-user tells a subscriber application to subscribe to a feed with a specific URI, the subscriber will subscribe to a hub specified in the feed, not to the filtering/processing hub (since that hub wasn&#8217;t  specified in any way). A possible way for enabling end-users to select which hub they want to use is to generate dummy feeds on filtering/processing hubs (e.g. <a href="http://www.hubforfiltering.com/http://www.myfeed.com/atom" rel="nofollow">http://www.hubforfiltering.com/http://www.myfeed.com/atom</a>). The contents of this dummy feed is the same as the contents of the original feed but with a simple difference &#8211; the hub elements from the original feed are removed and a hub element for new hub is inserted. This way, when the end-user passes the dummy feed URI to the subscriber application, the application will subscribe to the filtering/processing hub, not the original one. The filtering/processing hub then subscribes to the original hub to receive updates, filters/processes received updates and notifies the subscriber.</li>
<li><strong>Masking the filtering/processing services as the subscriber which then notifies the real subscriber. </strong>I&#8217;m not sure this is possible (too lazy to go through the PSHB spec), but in theory, here&#8217;s how it would work. The subscriber would obtain an URI pointing to the filtering/processing service for which the service would know what the real subscriber notification callback is (e.g. <a href="http://www.filter.com?subscriber=http://www.realsubscriber.com/callback" rel="nofollow">http://www.filter.com?subscriber=http://www.realsubscriber.com/callback</a>). The subscriber would subscribe to the hub using the obtained URI. When the publisher publishes an update, the hub would pass the update to the filtering/processing service thinking it was the subscriber. The filtering/processing service would do it&#8217;s thing and pass the update to the real subscriber. It&#8217;s unclear though how this would be done by end-users since they&#8217;d have to know the subscriber application&#8217;s callback URI.</li>
</ol>
<p><strong>All of these approaches have their pros and cons.</strong> Some are not easily or at all end-user definable, some may introduce unnecessary duplication of notifications, some introduce delivery of unwanted notifications, some do not support reuse of existing infrastructure and cause unnecessary duplication of systems, and most do not promote the development of filtering/processing services as a separate part of the ecosystem.</p>
<h2>Real-time feed processing and filtering (take 2)</h2>
<p>What I believe is needed is an architecture and protocol which supports three things. First &#8211; <strong>filtering/processing services as a separate part of the ecosystem</strong>. Since publishers and subscribers can&#8217;t possibly anticipate and implement every possible filter and processing service, this will enable a stream of development activity resulting in services with different functionality, performance and business models. Again, applications enabling other applications help software ecosystems grow.</p>
<p>Second &#8211; <strong>a scalable processing model where hubs invoke filtering/processing services</strong>. Regarding architectural decisions on where filtering/processing should be applied, there&#8217;s a paper (<a href="http://portal.acm.org/citation.cfm?id=343622" target="_blank">citation</a>, <a href="http://eprints.kfupm.edu.sa/22490/1/22490.pdf" target="_blank">pdf</a>) from 2000. on &#8220;<em>Achieving Scalability and Expressiveness in an Internet-scale Event Notification Service</em>&#8221; which states two principles:</p>
<blockquote><p>Downstream replication: A notification should be routed in one copy as far as possible and should be replicated only downstream, that is, as close as possible to the parties that are interested in it.</p>
<p>Upstream evaluation: Filters are applied and patterns are assembled upstream, that is, as close as possible to the sources of (patterns of) notifications.</p></blockquote>
<p>In short, these principles state that <strong>filtering services should be applied as close to the publisher</strong> as possible so notifications that nobody wants don&#8217;t waste network resources. However, <strong>processing services should be applied as close to the subscriber</strong> so that the original update may be transported through the network as a single notification for as long as possible. In cases where there&#8217;s a single hub between the publisher and subscriber, the same hub would invoke both processing and filtering services. However, in more complex hub network topologies different hubs would invoke different types of services based on their topological proximity to the subscriber/publisher.</p>
<p>Third and last &#8211; <strong>end-user selection of these services</strong>. When 3rd party filtering/processing services exist &#8211; how will they be chosen for a particular subscription? In my opinion, this must be done by end-users and thus there must be an easy way of doing it. The first thing that comes to mind would be to extend the subscription user-interface (UI) exposed to users of subscriber applications. E.g. instead of just showing a textbox for defining the feed the users wants to follow, there could be an &#8220;Advanced&#8221; menu with textboxes for defining filtering and processing services.</p>
<div data-shortcode="caption" id="attachment_325" style="width: 464px" class="wp-caption aligncenter"><a href="https://izuzak.wordpress.com/wp-content/uploads/2010/01/pshbnew.png"><img aria-describedby="caption-attachment-325" loading="lazy" data-attachment-id="325" data-permalink="https://izuzak.wordpress.com/2010/01/11/real-time-feed-processing-and-filtering/pshbnew/" data-orig-file="https://izuzak.wordpress.com/wp-content/uploads/2010/01/pshbnew.png" data-orig-size="814,506" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="New PSHB architecture and protocol outline" data-image-description="" data-image-caption="&lt;p&gt;New PSHB architecture and protocol outline&lt;/p&gt;
" data-large-file="https://izuzak.wordpress.com/wp-content/uploads/2010/01/pshbnew.png?w=720" class="size-full wp-image-325  " title="New PSHB architecture and protocol outline" src="https://izuzak.wordpress.com/wp-content/uploads/2010/01/pshbnew.png?w=720" alt="New PSHB architecture and protocol outline"   srcset="https://izuzak.wordpress.com/wp-content/uploads/2010/01/pshbnew.png?w=454&amp;h=282 454w, https://izuzak.wordpress.com/wp-content/uploads/2010/01/pshbnew.png?w=150&amp;h=93 150w, https://izuzak.wordpress.com/wp-content/uploads/2010/01/pshbnew.png?w=300&amp;h=186 300w, https://izuzak.wordpress.com/wp-content/uploads/2010/01/pshbnew.png?w=768&amp;h=477 768w, https://izuzak.wordpress.com/wp-content/uploads/2010/01/pshbnew.png 814w" sizes="(max-width: 454px) 100vw, 454px" /></a><p id="caption-attachment-325" class="wp-caption-text">New PSHB architecture and protocol outline</p></div>
<p>No matter how cool I think this would be as a core part of the PSHB protocol, it&#8217;s probably a better idea doing it as an extension (as a first step?). So here&#8217;s what the extension would define:</p>
<ol>
<li>The subscription part of the protocol additionally <strong>enables subscribers to define two lists of URIs </strong>when subscribing to a hub<strong>, one declaring the list of filtering services and the other the list of processing services </strong>that should be applied.</li>
<li><strong>Hubs are responsible </strong>not only for delivery of notifications but also<strong> for calling filtering/processing services</strong> on those notifications and receiving their responses. An inter-hub subscription negotiation/propagation <strong>mechanism that enables the optimal placement of subscription-defined filters and processing services in the delivery flow</strong>. In case of a single hub, nothing needs to be done since the hub invokes both types of services. However, in case of two hubs, the hub which first received the subscription would locally subscribe to the second hub stating only the filtering services while processing services would not be sent upstream. Thus, the hub closer to the subscriber would be responsible for invoking processing services, and the hub closer to the publisher would be responsible for invoking filtering services. This could, I believe, be generalized and formalized for any kind of hub network topology.</li>
<li>When an update is published, hubs responsible for invoking filtering or processing services must do so before forwarding the notifications downstream. There are several performance-related issues which need to be addressed here. First, <strong>the invocation of filtering/processing services should be asynchronous, </strong><a href="http://www.webhooks.org/" target="_blank"><strong>webhook</strong></a><strong>-based</strong> (the hub calls a service passing an URI to which the result of processing should be POSTed). Second, <strong>invocation of services on a specific hub for a specific notification should be done in parallel</strong>, except if multiple processing services were defined for a single subscription in which case those processing services must be invoked serially (filters can always be invoked in parallel). Third, there&#8217;s a not-so-clear trade-off between a) waiting for all invoked filters to respond and sending a single notification carrying all metadata regarding which filters it satisfied and b) <strong>sending  multiple notifications containing the same content but different metadata regarding which filters were satisfied </strong>(e.g. as each filter responds). Since all filters will not respond at the same time (some will respond sooner, some later and some possibly never) &#8211; waiting for all filters invoked in parallel before continuing seems contradictory to the constraint of real-time delivery. On the other hand, creating multiple notifications with the same data will introduce an overhead in the network. Overall, I believe that the overhead will not be substantial since there will not be many duplicates &#8212; this can even be regulated as a hub-level parameter e.g. one notification for services returning in under 2 seconds, one for under 10 second, and one for everything else, and the benefit is basically a necessity.</li>
</ol>
<h2>Conclusion</h2>
<p>Of course I didn&#8217;t consider all aspects of the problem and there are a lot more points of view to be considered, from is it legal to change content in a feed and in what way to how do we make this extension secure and fault tolerant? Nevertheless, I believe that the need and expertise are here and that it&#8217;s an <strong>opportunity to make the real time web better</strong>. What are your ideas for extending real-time content delivery technologies? <a href="http://www.twitter.com/izuzak" target="_blank">@izuzak</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://izuzak.wordpress.com/2010/01/11/real-time-feed-processing-and-filtering/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">169</post-id>
		<media:content medium="image" url="https://1.gravatar.com/avatar/db8f5d658a8f5bfd6ed0442054eb545bfa58ae59aabb92e6495f372966d0d3de?s=96&amp;d=https%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96">
			<media:title type="html">izuzak</media:title>
		</media:content>

		<media:content medium="image" url="https://izuzak.wordpress.com/wp-content/uploads/2010/01/fbdemopic.png?w=300">
			<media:title type="html">Feed-buster</media:title>
		</media:content>

		<media:content medium="image" url="https://izuzak.wordpress.com/wp-content/uploads/2010/01/fb.png?w=300">
			<media:title type="html">Feed-buster architecture</media:title>
		</media:content>

		<media:content medium="image" url="https://izuzak.wordpress.com/wp-content/uploads/2010/01/fbgae.png">
			<media:title type="html">Feed-buster - AppEngine request processing duration graph</media:title>
		</media:content>

		<media:content medium="image" url="https://izuzak.wordpress.com/wp-content/uploads/2010/01/pshbarch.png">
			<media:title type="html">PubSubHubBub ecosystem and protocol</media:title>
		</media:content>

		<media:content medium="image" url="https://izuzak.wordpress.com/wp-content/uploads/2010/01/pshbnew.png">
			<media:title type="html">New PSHB architecture and protocol outline</media:title>
		</media:content>
	</item>
		<item>
		<title>RPC for Web Workers and distributed computing within the browser</title>
		<link>https://izuzak.wordpress.com/2009/12/21/rpc-for-web-workers-and-distributed-computing-within-the-browser/</link>
					<comments>https://izuzak.wordpress.com/2009/12/21/rpc-for-web-workers-and-distributed-computing-within-the-browser/#comments</comments>
		
		<dc:creator><![CDATA[Ivan Zuzak]]></dc:creator>
		<pubDate>Mon, 21 Dec 2009 09:07:35 +0000</pubDate>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[communication]]></category>
		<category><![CDATA[discovery]]></category>
		<category><![CDATA[distributed computing]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[json-rpc]]></category>
		<category><![CDATA[pmrpc]]></category>
		<category><![CDATA[remote procedure call]]></category>
		<category><![CDATA[rpc]]></category>
		<category><![CDATA[web workers]]></category>
		<guid isPermaLink="false">http://izuzak.wordpress.com/?p=252</guid>

					<description><![CDATA[This blog has moved to a new domain. You can view this post here. In a previous post I wrote about pmrpc &#8211; a project of mine for developing a JavaScript library for cross-domain inter-window RPC-style communication in HTML5 browsers. RPC communication is based on two technologies: HTML5 cross-domain messaging as the transport mechanism and JSON-RPC [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><em><strong>This blog has moved to a <a href="http://ivanzuzak.info">new domain</a>. You can view this post <a href="http://ivanzuzak.info/2009/12/21/rpc-for-web-workers-and-distributed-computing-within-the-browser.html">here</a>.<br />
</strong></em></p>
<p><a href="https://izuzak.wordpress.com/2009/10/10/inter-window-browser-communication-and-how-to-make-it-better/" target="_blank">In a previous post</a> I wrote about <a href="http://code.google.com/p/pmrpc" target="_blank">pmrpc</a> &#8211; a project of mine for developing a JavaScript library for <strong>cross-domain inter-window RPC-style communication in HTML5 browsers</strong>. RPC communication is based on two technologies: <a href="http://dev.w3.org/html5/spec/Overview.html#crossDocumentMessages" target="_blank">HTML5 cross-domain messaging</a> as the transport mechanism and <a href="http://groups.google.com/group/json-rpc/web/json-rpc-1-2-proposal" target="_blank">JSON-RPC</a> as the RPC protocol and message format, while the library supports other advanced features (access control, asynchronous calls, retries&#8230;). At the end of the post I outlined a few things <a href="http://twitter.com/ivankovic_42" target="_blank">Marko</a> and I wanted to implement next in pmrpc, one of which was support for Web Workers. From the post:</p>
<blockquote><p><a href="http://www.whatwg.org/specs/web-workers/current-work/" target="_blank"><strong>Web Workers</strong></a> are another specification being developed in parallel with HTML5. The specification “defines an API for running scripts in the background independently of any user interface scripts”. What’s interesting is that the postMessage API is used to communicate with web workers and therefor pmrpc could be extended to include support for web workers.</p></blockquote>
<p>Well, the API used to send messages from a web page to a worker and vice versa is not exactly the same as the cross-document messaging API, but is very similar. So, the idea for supporting Web Workers was leave the <a href="http://code.google.com/p/pmrpc/wiki/PmrpcApiDocs" target="_blank">pmrpc API</a> for registering, calling and unregistering procedure unchanged, and just extend it to also use the Web Worker API for message transport (in addition to the cross-doc messaging). And about two weeks ago we released <a href="http://code.google.com/p/pmrpc/downloads/list" target="_blank">a new version of pmrpc</a> with Web Worker support. Here&#8217;s an example of <strong>using pmrpc with Web Workers</strong>:</p>
<pre class="brush: jscript; title: ; notranslate">
// [worker object A - testingWorker.js]

// load pmrpc library
importScripts('pmrpc.js');

// expose a procedure
pmrpc.register( {
publicProcedureName : &quot;HelloPMRPC&quot;,
procedure : function(printParam) {
              alert(printParam); } } );
</pre>
<pre class="brush: jscript; title: ; notranslate">

// [window object B]

// load pmrpc library

// create worker
var testingWorker =
  new Worker(&quot;testingWorker.js&quot;);

// calls the exposed procedure
pmrpc.call( {
destination : testingWorker,
publicProcedureName : &quot;HelloPMRPC&quot;,
params : [&quot;Hello World!&quot;] } );
</pre>
<p>A few notes on worker support. Pmrpc currently supports only normal (&#8220;dedicated&#8221;) Web Workers. Shared Workers (workers shared between multiple web pages) and nested workers (workers within workers) are currently not supported since, as far as I know,<strong> Shared and nested Workers are not implemented yet in any browser</strong>. Also, since Workers must be loaded from the same origin as the page that created them &#8211; the <a href="http://code.google.com/p/pmrpc/wiki/PmrpcApiDocs#Access_control" target="_blank">access control feature</a> in pmrpc make no sense and are therefore not supported for Web Workers.</p>
<p>Next on our list is enabling <strong>discovery of registered procedures</strong> scattered over multiple browser workers, iframes and windows. Currently, pmrpc requires that you tell it where the procedure you are calling is, but sometimes you don&#8217;t know where it is, or don&#8217;t care &#8211; e.g. you just want to call the &#8220;DrawMap&#8221; procedure loaded from domain &#8220;<a href="http://www.good.com&#038;#8221" rel="nofollow">http://www.good.com&#038;#8221</a>; if it exists. Discovery should enable discovery of methods based just on their names. The problems in implementing this feature (knowing which windows, iframes and workers are currently running and syncing the list of registered procedures with each of them) made me think about where systems running in browsers are heading &#8211; towards a form of <strong>distributed &amp; parallel computing, only within a single browser</strong>. Distributed and concurrent execution, discovery, access control, synchronization, remote invocation, fault tolerance and naming are all concepts well know in distributed computing, and will possibly be re-invented in the context of web browsers to support this new shift. I&#8217;m not sure how far pmrpc will go in this direction, but I hope it will be a good example for other developers and research projects.</p>
<p>Do you think that web browsers need more powerful mechanisms supporting this new form of distributed computing? <a href="http://www.twitter.com/izuzak" target="_blank">@izuzak</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://izuzak.wordpress.com/2009/12/21/rpc-for-web-workers-and-distributed-computing-within-the-browser/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">252</post-id>
		<media:content medium="image" url="https://1.gravatar.com/avatar/db8f5d658a8f5bfd6ed0442054eb545bfa58ae59aabb92e6495f372966d0d3de?s=96&amp;d=https%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96">
			<media:title type="html">izuzak</media:title>
		</media:content>
	</item>
		<item>
		<title>Extending and customizing Google Code project hosting</title>
		<link>https://izuzak.wordpress.com/2009/12/14/extending-and-customizing-google-code-project-hosting/</link>
					<comments>https://izuzak.wordpress.com/2009/12/14/extending-and-customizing-google-code-project-hosting/#comments</comments>
		
		<dc:creator><![CDATA[Ivan Zuzak]]></dc:creator>
		<pubDate>Mon, 14 Dec 2009 15:18:59 +0000</pubDate>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[customizing]]></category>
		<category><![CDATA[extending]]></category>
		<category><![CDATA[gadgets]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google code]]></category>
		<category><![CDATA[google code project hosting]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[mime-types]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[project hosting]]></category>
		<category><![CDATA[svn]]></category>
		<guid isPermaLink="false">http://izuzak.wordpress.com/?p=186</guid>

					<description><![CDATA[This blog has moved to a new domain. You can view this post here. I&#8217;ve used Google Code project hosting for almost every project I&#8217;ve started in the last few years. It&#8217;s really great and I love both the Web UI and all the functionality-related features (which Google is continuously extending). However, one aspect in which I&#8217;ve found [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><em><strong>This blog has moved to a <a href="http://ivanzuzak.info">new domain</a>. You can view this post <a href="http://ivanzuzak.info/2009/12/13/extending-and-customizing-google-code-project-hosting.html">here</a>.<br />
</strong></em></p>
<p style="text-align:left;"><a href="http://code.google.com/hosting/" target="_blank"><img loading="lazy" class="alignright" style="margin-top:25px;margin-bottom:15px;" title="Google Code" src="https://i0.wp.com/www.gstatic.com/codesite/ph/images/code_small.png" alt="" width="161" height="40" /></a>I&#8217;ve used <a href="http://code.google.com/hosting/" target="_blank"><strong>Google Code project hosting</strong></a> for almost every project I&#8217;ve started in the last few years. It&#8217;s really great and I love both the Web UI and all the functionality-related features (which Google is <a href="http://code.google.com/p/support/wiki/WhatsNew" target="_blank">continuously extending</a>). However, one aspect in which I&#8217;ve found Google Code project hosting<strong> strangely lacking </strong><strong>is customizability and extendability</strong> in adding rich content and even external applications to a project site. Wouldn&#8217;t it be great if we could add a special &#8220;Testing&#8221; and &#8220;Group discussion&#8221; tab or an easy way to embed presentations and JavaScript code into wiki pages? This would boost the usability of project sites and make the visitor experience so much better.</p>
<p>So, I&#8217;ve been thinking about this idea and playing with <strong>hacks and workarounds for extending Google code sites</strong> <a href="http://code.google.com/p/pmrpc/" target="_blank">for</a> <a href="http://code.google.com/p/urlecho/" target="_blank">my</a><a href="http://code.google.com/p/feed-buster/" target="_blank"> projects</a>, and what I&#8217;ve discovered is that I&#8217;m not alone &#8211; <a href="http://code.google.com/p/pubsubhubbub/" target="_blank">several</a> <a href="http://code.google.com/p/google-caja/" target="_blank">other</a> <a href="http://code.google.com/p/closure-library/" target="_blank">projects</a> have been doing this also. So in this post I&#8217;ll try to cover two approaches to extending and customizing Google Code project hosting: embedding 3rd party content using <strong>Google Gadgets</strong> and viewing non-source files in the repository using the <strong>SVN mime-types property</strong>.</p>
<p>The first idea for extending project sites is to <strong>embed 3-rd party content into wiki pages</strong> (Google Docs presentations, JavaScript programs and such). Although it is possible to use a <a href="http://code.google.com/p/support/wiki/WikiSyntax#HTML_support" target="_blank">large subset of HTML</a> in project wiki pages, &lt;iframe&gt; and &lt;script&gt; tags are not available. However, embedding Google Gadgets <em>is </em>supported. <a href="http://code.google.com/apis/gadgets/" target="_blank"><strong>Google Gadgets</strong></a> are &#8221; simple HTML and JavaScript applications that can be embedded in webpages and other apps&#8221; (think clock, calendar, twitter and similar widgets) and are, in essence, an HTML &lt;iframe&gt; embedded in the parent page. Although there is a <a href="http://www.google.com/ig/directory?synd=open" target="_blank">public directory of existing Gadgets</a> which you could add to your wiki pages, what&#8217;s more interesting is that you can build a Gadget yourself and that it&#8217;s really easy to do. So, finally, the first idea for extending Google Code project hosting is to<strong> build your own Google Gadgets which wrap the content you want to embed in your wiki page</strong>. Here&#8217;s what you need to do:</p>
<ol style="padding-left:30px;">
<li>Create a file containing a blank, content-less XML Gadget specification &#8212; you can just copy/paste the code from the <a href="http://code.google.com/apis/gadgets/docs/gs.html#Hello_World" target="_blank">Google Gadgets tutorial</a>.</li>
<li>Define the content of the Gadget. Depending on what you want to embed in your wiki page, there are two ways to go here:
<ol>
<li>If you want to embed an existing web page or rich content available on the Web, the content of the Gadget will be a single &lt;iframe&gt; element with the src attribute pointing to the URL of that web-page.</li>
<li>If you want to embed content which does not exist on the web, you will have to write the HTML + JavaScript code that defines that content yourself and inline it in the Gadget. Be sure to check out the <a href="http://code.google.com/apis/gadgets/docs/dev_guide.html" target="_blank">Google Gadgets developer guide</a>.</li>
</ol>
</li>
<li>Save and upload the Gadget XML specification file into your project repository.</li>
<li>Edit one of your wiki pages and create a Google Gadget element that references the URL of the uploaded specification. <strong>Note</strong> that you must reference the raw-file URL of the XML spec which you can get by viewing the uploaded file in your project&#8217;s Source tab and then clicking &#8220;View raw file&#8221; under File info.</li>
</ol>
<table style="padding-left:30px;" border="0">
<tbody>
<tr>
<td>
<p><div style="width: 330px" class="wp-caption aligncenter"><a href="http://code.google.com/p/pubsubhubbub"><img loading="lazy" class="   " style="margin:5px;" title="Example 1" src="https://izuzak.wordpress.com/wp-content/uploads/2009/12/blog_pres1.png?w=320&#038;h=200" alt="Example 1" width="320" height="200" /></a><p class="wp-caption-text">Example 1 - PubSubHubBub project</p></div></td>
<td>
<p><div style="width: 330px" class="wp-caption aligncenter"><a href="http://code.google.com/p/feed-buster"><img loading="lazy" class="   " style="margin-top:5px;margin-bottom:5px;" title="Example 2" src="https://izuzak.wordpress.com/wp-content/uploads/2009/12/blog_ff1.png?w=320&#038;h=200" alt="Example 2" width="320" height="200" /></a><p class="wp-caption-text">Example 2 - FeedBuster project</p></div></td>
</tr>
<tr>
<td>
<p><div style="width: 330px" class="wp-caption aligncenter"><a href="http://code.google.com/p/pmrpc/wiki/PmrpcTesting"><img loading="lazy" class="   " style="margin:5px;" title="Example 3" src="https://izuzak.wordpress.com/wp-content/uploads/2009/12/blog_qunit1.png?w=320&#038;h=200" alt="Example 3" width="320" height="200" /></a><p class="wp-caption-text">Example 3 - Pmrpc project</p></div></td>
<td>
<p><div style="width: 330px" class="wp-caption aligncenter"><a href="http://code.google.com/p/urlecho"><img loading="lazy" class="  " style="margin:5px;" title="Example 4" src="https://izuzak.wordpress.com/wp-content/uploads/2009/12/blog_form1.png?w=320&#038;h=200" alt="Example 4" width="320" height="200" /></a><p class="wp-caption-text">Example 4 - UrlEcho project</p></div></td>
</tr>
</tbody>
</table>
<p>And here are some examples that show the usefulness of this approach:</p>
<ol style="padding-left:30px;">
<li><strong>Embedding Google Docs presentations</strong> that visually explain details of your project (<a href="http://code.google.com/p/pubsubhubbub/" target="_blank">example project wiki page</a> and <a href="http://code.google.com/p/pubsubhubbub/source/browse/trunk/presentation_gadget.xml" target="_blank">XML spec</a>). To get a Google Docs URL which you can use for embedding, go the presentation&#8217;s page in Google Docs, click &#8220;Share &#8211; Publish/Embed&#8221;, and copy the URL under &#8220;Your document is publicly viewable at:&#8221;.</li>
<li><strong>Embedding a FriendFeed discussion groups</strong> for in-place discussions (<a href="http://code.google.com/p/feed-buster/#Feedback" target="_blank">example project wiki page</a> and <a href="http://hosting.gmodules.com/ig/gadgets/file/105320743644204138718/feedbuster.xml" target="_blank">XML spec</a> &#8212; if you see a blank page, view the source of the page). To get a FriendFeed group URL which you can use for embedding, use the <a href="http://friendfeed.com/embed/realtime" target="_blank">official FriendFeed instructions</a> (basically, it&#8217;s <a href="http://friendfeed.com/GROUP_NAME_HERE/embed" rel="nofollow">http://friendfeed.com/GROUP_NAME_HERE/embed</a> e.g. <a href="http://friendfeed.com/feed-buster/embed">http://friendfeed.com/feed-buster/embed</a>).</li>
<li><strong>Embedding QUnit testing pages</strong> for following project stability and cross-browser testing (<a href="http://code.google.com/p/pmrpc/wiki/PmrpcTesting" target="_blank">example project wiki page</a> and <a href="http://code.google.com/p/pmrpc/source/browse/trunk/testing/testingGadget.xml" target="_blank">XML spec</a>). This one is a bit complex &#8212; first you&#8217;ll need to create and upload a HTML page containing the QUnit test page (setting the mime-type property to text/html using instructions below) into your repository, and then link to the raw page URL in the &lt;iframe&gt; inside your Gadget.</li>
<li><strong>Embedding dynamic content</strong> and forms (<a href="http://code.google.com/p/urlecho/#AppEngine_server" target="_blank">example project wiki page</a> and <a href="http://code.google.com/p/urlecho/source/browse/trunk/googlecodegadget.xml" target="_blank">XML spec</a>). There is no outside content in the Gadget spec here, everything is in the Gadget. <strong>Note </strong>that the XML spec in the example also contains CSS styles so that the Gadget content has the same look-and -feel as the rest of the wiki page so visitors won&#8217;t event know that a Gadget is there.</li>
</ol>
<p>The second idea for extending project sites involves <strong>using the source repository for hosting non-source files</strong> which will be viewed by project site visitors. This is useful if you want the freedom of creating custom web pages (not embed them into project wikis) and if you want to keep all those files in the project repository (and not on some other server). The idea here is to use the raw-file URL for files in the repository &#8211; visiting the raw-file view URL returns only the content of the file without the UI stuff of Google Code. The problem is that, by default, any file uploaded to the repository is attributed to be of type <em>text</em>, so when you view the raw-file URL in the browser you get the content as text, which is useless if you want to see a HTML page. The good thing is that using custom SVN per-file properties it is possible to set the type of the file when it is uploaded in the repository. So, finally, the second idea for extending Google Code project hosting is to <strong>upload your content files into the repository and explicitly set their mime-types to the correct value</strong>. Here&#8217;s what you need to do :</p>
<ol>
<li>Create your content and save it into a file on your hard drive in the project repository folder.</li>
<li>Right-click the file and under TortoiseSVN -&gt; Properties click &#8220;New&#8221;. In the &#8220;Property name&#8221; drop-down list choose &#8220;svn:mime-type&#8221; and ender the correct mime type for that file. You can find a list of all mime types here. E.g. for HTML pages it&#8217;s &#8220;text/html&#8221; (this is for TortoiseSVN, command-line version is <a href="http://code.google.com/p/support/wiki/SubversionFAQ#How_can_I_make_SVN_serve_HTML_and_images_with_the_correct_Conten" target="_blank">here</a>).</li>
<li>Upload the file to the repository.</li>
<li>Obtain the URL to the raw-file by viewing the uploaded file in your project&#8217;s Source tab and then clicking &#8220;View raw file&#8221; under File info.</li>
<li>Create a link to the obtained URL from one of your wiki pages.</li>
</ol>
<table style="padding-left:30px;" border="0">
<tbody>
<tr>
<td>
<p><div style="width: 330px" class="wp-caption aligncenter"><a href="http://pubsubhubbub.googlecode.com/svn/trunk/pubsubhubbub-core-0.2.html"><img loading="lazy" class="  " style="margin-top:5px;margin-bottom:5px;" title="Example 1" src="https://izuzak.wordpress.com/wp-content/uploads/2009/12/blog_pshb.png?w=320&#038;h=200" alt="Example 1" width="320" height="200" /></a><p class="wp-caption-text">Example 1 - PubSubHubBub project</p></div></td>
<td>
<p><div style="width: 330px" class="wp-caption aligncenter"><a href="http://closure-library.googlecode.com/svn/trunk/closure/goog/docs/index.html"><img loading="lazy" class="  " style="margin-top:5px;margin-bottom:5px;" title="Example 2" src="https://izuzak.wordpress.com/wp-content/uploads/2009/12/blog_closure.png?w=320&#038;h=200" alt="Example 2" width="320" height="200" /></a><p class="wp-caption-text">Example 2 - Closure library project</p></div></td>
</tr>
</tbody>
</table>
<p>And here are two examples that show the usefulness of this approach:</p>
<ol>
<li><strong>Creating a protocol specification with custom styling</strong> (<a href="http://pubsubhubbub.googlecode.com/svn/trunk/pubsubhubbub-core-0.2.html" target="_blank">example project page</a> and <a href="http://code.google.com/p/pubsubhubbub/source/browse/trunk/pubsubhubbub-core-0.2.html" target="_blank">source file</a>)</li>
<li><strong>Creating advanced API docs</strong> (<a href="http://closure-library.googlecode.com/svn/trunk/closure/goog/docs/index.html" target="_blank">example project page</a> and <a href="http://code.google.com/p/closure-library/source/browse/#svn/trunk/closure/goog/docs/index.html" target="_blank">source file</a> &#8212; note: you will not be able to view the source file, access is being blocked somehow)</li>
</ol>
<p>And that&#8217;s it. Go fancy-up your project sites and let me know if you know any other cool ways of extenting Google Code project hosting. <a href="http://www.twitter.com/izuzak" target="_blank">@izuzak</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://izuzak.wordpress.com/2009/12/14/extending-and-customizing-google-code-project-hosting/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">186</post-id>
		<media:content medium="image" url="https://1.gravatar.com/avatar/db8f5d658a8f5bfd6ed0442054eb545bfa58ae59aabb92e6495f372966d0d3de?s=96&amp;d=https%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96">
			<media:title type="html">izuzak</media:title>
		</media:content>

		<media:content medium="image" url="http://www.gstatic.com/codesite/ph/images/code_small.png">
			<media:title type="html">Google Code</media:title>
		</media:content>

		<media:content medium="image" url="https://izuzak.wordpress.com/wp-content/uploads/2009/12/blog_pres1.png">
			<media:title type="html">Example 1</media:title>
		</media:content>

		<media:content medium="image" url="https://izuzak.wordpress.com/wp-content/uploads/2009/12/blog_ff1.png">
			<media:title type="html">Example 2</media:title>
		</media:content>

		<media:content medium="image" url="https://izuzak.wordpress.com/wp-content/uploads/2009/12/blog_qunit1.png">
			<media:title type="html">Example 3</media:title>
		</media:content>

		<media:content medium="image" url="https://izuzak.wordpress.com/wp-content/uploads/2009/12/blog_form1.png">
			<media:title type="html">Example 4</media:title>
		</media:content>

		<media:content medium="image" url="https://izuzak.wordpress.com/wp-content/uploads/2009/12/blog_pshb.png">
			<media:title type="html">Example 1</media:title>
		</media:content>

		<media:content medium="image" url="https://izuzak.wordpress.com/wp-content/uploads/2009/12/blog_closure.png">
			<media:title type="html">Example 2</media:title>
		</media:content>
	</item>
		<item>
		<title>Inter-window browser communication and how to make it better</title>
		<link>https://izuzak.wordpress.com/2009/10/10/inter-window-browser-communication-and-how-to-make-it-better/</link>
					<comments>https://izuzak.wordpress.com/2009/10/10/inter-window-browser-communication-and-how-to-make-it-better/#comments</comments>
		
		<dc:creator><![CDATA[Ivan Zuzak]]></dc:creator>
		<pubDate>Sat, 10 Oct 2009 11:38:46 +0000</pubDate>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[access control]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[communication]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[inter-iframe]]></category>
		<category><![CDATA[inter-widget]]></category>
		<category><![CDATA[inter-window]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[json-rpc]]></category>
		<category><![CDATA[postmessage]]></category>
		<category><![CDATA[remote procedure call]]></category>
		<category><![CDATA[rpc]]></category>
		<category><![CDATA[security]]></category>
		<guid isPermaLink="false">http://izuzak.wordpress.com/?p=35</guid>

					<description><![CDATA[Pmrpc is a JavaScript library for advanced inter-window cross-domain communication. The library utilizes the postMessage API as an underlying communication mechanism and extends it to a remote procedure call (RPC) model using JSON-RPC. JSON-RPC is a transport-independent protocol that uses the JSON data format for formatting messages. The pmrpc library provides a simple API for exposing and calling procedures from windows or iFrames on different domains. Furthermore, pmrpc also provides several features for advanced communication: callbacks for successful and unsuccessful calls, access control lists on both the client and server side, fault tolerance using user-defined retries and timeouts for each call, registering asychronous procedures.]]></description>
										<content:encoded><![CDATA[<p><em><strong>This blog has moved to a <a href="http://ivanzuzak.info">new domain</a>. You can view this post <a href="http://ivanzuzak.info/2009/10/10/inter-window-browser-communication-and-how-to-make-it-better.html">here</a>. </strong></em></p>
<p>As promised in my <a href="https://izuzak.wordpress.com/2009/08/09/named-arguments-in-javascript/" target="_blank">post on named arguments in JavaScript</a>, this post will be about <a href="http://code.google.com/p/pmrpc">pmrpc</a> &#8211; a project I&#8217;ve been working on with <a href="http://mivankovic.blogspot.com/" target="_blank">Marko</a> for the last few months.</p>
<p>But first, a bit of background. From mid 2007. when I was interning at Google up until today and my dissertation-related research, an issue that&#8217;s consistently been popping up in anything I worked on is inter-window communication. <strong>Inter-window communication (IWC)</strong> is the process of transporting data from one window object within a browser to another window object inside the same browser. What&#8217;s relevant here is that window objects are both full-size windows and iframes &#8211; window objects that can be embedded within other window objects (think of an <a href="http://www.igoogle.com" target="_blank">iGoogle</a> page and all the gadgets in it).</p>
<p><img loading="lazy" class="aligncenter" title="iGoogle" src="https://i0.wp.com/images.trustedreviews.com/images/article/inline/4513-igoogle.jpg" alt="" width="362" height="172" /></p>
<p>The reason why IWC is an issue is the security model of communication within browsers. <strong><a href="http://en.wikipedia.org/wiki/Same_origin_policy" target="_blank">Same Origin Policy</a></strong> (SOP), a security policy introduced to reduce security risks, restricts access of processes executing within browsers. In essence, SOP prevents a document or script loaded from one domain from getting or setting properties of a document from another domain. For example, a page loaded from <em><a href="http://www.google.com" rel="nofollow">http://www.google.com</a></em> can not directly access data in an iframe loaded from <em><a href="http://www.yahoo.com" rel="nofollow">http://www.yahoo.com</a></em>.</p>
<p>Although SOP turns Web applications into a set of isolated units, the <a href="http://groups.google.com/group/talk-about-widgets/web/use-cases-for-iwc" target="_blank">need for communication between those islands</a> is growing rapidly. With the advancement web technologies, web applications were slowly becoming componentized and many current web applications are based on <strong>mashing-up content from different sources</strong> &#8211; map gadgets, finance widgets, blog commenting toolboxes, games, chat widgets and <a href="http://www.google.com/ig/directory" target="_blank">many</a>, <a href="http://www.facebook.com/apps/directory.php" target="_blank">many</a> <a href="http://www.widgetbox.com/tag_cloud.jsp" target="_blank">others</a>. Since widgets, content encapsulated within an iframe, are the most popular method of including cross-domain content on a web page, <strong>inter-widget communication</strong> is most often implemented as inter-window communication.</p>
<p>A lot of <strong>groups and projects are researching models and developing systems</strong> that address the problem of communication between widgets and between windows in general. So here&#8217;s a short overview of this broad space of R&amp;D. <a href="http://www.opensocial.org/Technical-Resources/opensocial-spec-v09/Gadgets-API-Specification.html" target="_blank">Various</a> <a href="http://www.w3.org/TR/widgets/" target="_blank">widget</a> <a href="http://www.openajax.org/member/wiki/OpenAjax_Metadata_1.0_Specification_Widget_Overview" target="_blank">specifications</a> <a href="http://dev.opera.com/articles/view/opera-widgets-specification-1-0-third-ed-2/" target="_blank">are trying</a> to formally define and standardize what a widget actually is. <a href="http://code.google.com/p/browsersec/w/list" target="_blank">Browser security in general</a> and <a href="http://w2spconf.com/2007/papers/paper-170-z_6423.pdf" target="_blank">various issues</a> concerning <a href="http://seclab.stanford.edu/websec/frames/post-message.pdf" target="_blank">intra-browser communication</a> and <a href="http://domino.research.ibm.com/library/cyberdig.nsf/papers/0EE2D79F8BE461CE8525731B0009404D/$File/RT0742.pdf" target="_blank">mashup security</a> are <a href="http://www.adambarth.com/papers/2009/barth-weinberger-song.pdf" target="_blank">being</a> <a href="http://www.adambarth.com/papers/2009/barth-jackson-li.pdf" target="_blank">heavily</a> <a href="http://www.adambarth.com/papers/2009/reis-barth-pizano.pdf" target="_blank">researched</a>. <a href="http://www.cs.rutgers.edu/~vinodg/papers/acsac2008b/acsac2008b.pdf" target="_blank">Low-level IWC mechanisms</a> are <a href="http://json.org/module.html" target="_blank">being</a> <a href="http://dev.w3.org/html5/spec/Overview.html#crossDocumentMessages" target="_blank">proposed</a> and <a href="http://code.google.com/p/xssinterface/" target="_blank">implemented</a>, sometimes even as <a href="http://tagneto.blogspot.com/2006/06/cross-domain-frame-communication-with.html" target="_blank">browser hacks</a>, and <a href="http://www.openajax.org/member/wiki/OpenAjax_Hub_1.1_Specification_Publish_Subscribe_Overview" target="_blank">high-level</a> <a href="http://www.cs.rutgers.edu/~vinodg/papers/acsac2008b/acsac2008b.pdf" target="_blank">communication models</a> are being <a href="http://www2009.eprints.org/138/" target="_blank">researched</a> and <a href="http://svn.apache.org/repos/asf/incubator/shindig/trunk/features/src/main/javascript/features/rpc/" target="_blank">developed</a>. Even patents have been filed for methods of <a href="http://www.faqs.org/patents/app/20080295024" target="_blank">inter-window</a> and <a href="http://www.wipo.int/pctdb/en/wo.jsp?WO=2009036093" target="_blank">inter-widget</a> communication.</p>
<p><img loading="lazy" class="alignleft" title="HTML5 logo" src="https://i0.wp.com/www.newsgeek.co.il/wp-content/uploads/2009/06/html5-logo.jpg" alt="" width="150" height="200" /></p>
<p>Among all of these efforts, one is catching on on a wider scale &#8211; the <strong><a href="http://dev.w3.org/html5/spec/Overview.html#crossDocumentMessages" target="_blank">HTML5 cross-document messaging specification</a></strong> aka the <strong>postMessage API</strong>.  The postMessage API has been implemented in all popular web browsers and enables secure message-oriented communication between any window objects &#8211; scripts in any window may send messages to any other window and receive messages from scripts in other windows. Security is established by two access-control mechanisms: 1) the message sender may specify the domain from which the destination window must be loaded in order for the message to be delivered, and 2) the message receiver may inspect the domain from which a message was sent and drop unwanted messages.</p>
<p>The <strong>problem with postMessage is that it&#8217;s a very low-level and general</strong> communication mechanism which requires a lot of boiler-plate code every time it is used and even more if one wants to implement advanced communication or access-control models. Have a look at the <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#introduction-5" target="_blank">example on using postMessage in the HTML5 spec</a> to see what I&#8217;m talking about. However, it&#8217;s exactly this generality and low-levelness that makes <strong>postMessage an excellent foundation to build upon</strong>! Some of the projects I mentioned above have been working on <a href="http://svn.apache.org/repos/asf/incubator/shindig/trunk/features/src/main/javascript/features/rpc/" target="_blank">advanced</a> <a href="http://svn.apache.org/repos/asf/incubator/shindig/trunk/features/src/main/javascript/features/pubsub/" target="_blank">communication libraries</a> based on postMessage, but none that I know of are open-source and applicable in any context but rather tied to a specific application environment. Furthermore, advanced access control, fault tolerance and many other aspects of inter-window communication have been under-explored. These drawbacks were the main motivators for developing pmrpc.</p>
<p><img loading="lazy" class="aligncenter" title="pmrpc logo" src="http://code.google.com/p/pmrpc/logo?logo_id=1248529567" alt="" width="55" height="55" /></p>
<p><strong><a href="http://code.google.com/p/pmrpc" target="_blank">Pmrpc</a></strong> (<em><strong>p</strong>ost<strong>M</strong>essage <strong>r</strong>emote <strong>p</strong>rocedure <strong>c</strong>all</em>) is a JavaScript library for advanced inter-window cross-domain communication. The library utilizes the postMessage API as an underlying communication mechanism and extends it to a <a href="http://en.wikipedia.org/wiki/Remote_procedure_call" target="_blank">remote procedure call (RPC) model</a> using JSON-RPC. <a href="http://groups.google.com/group/json-rpc/web/json-rpc-1-2-proposal" target="_blank">JSON-RPC</a> is a transport-independent protocol that uses the <a href="http://www.json.org" target="_blank">JSON data format</a> for formatting messages. The pmrpc library provides a simple API for exposing and calling procedures from windows or iFrames on different domains.</p>
<p>Here&#8217;s a <strong>simple example</strong> for calling a function in another window:</p>
<p style="padding-left:30px;">1. First, a procedure is registered for remote calls in the window or iFrame that contains the procedure:</p>
<pre style="padding-left:30px;"><pre class="brush: jscript; title: ; notranslate">
// [window object A] exposes a procedure in it's window
pmrpc.register( {
  publicProcedureName : &quot;HelloPMRPC&quot;,
  procedure : function(printParam) { alert(printParam); } } );
</pre>
<p> 2. Second, the procedure is called from a remote window or iFrame by specifying the window object which contains the remote procedure, name of the procedure and parameters:    </p>
<pre style="padding-left:30px;"><pre class="brush: jscript; title: ; notranslate">
// [window object B] calls the exposed procedure remotely, from its own window
pmrpc.call( {
  destination : window.frames[&quot;myIframe&quot;],
  publicProcedureName : &quot;HelloPMRPC&quot;,
  params : [&quot;Hello World!&quot;] } );
</pre>
<p> Furthermore, pmrpc also provides several <strong>features for advanced communication</strong>: <strong>callbacks</strong> for successful and unsuccessful calls, <strong>access control lists</strong> on both the client and server side, <strong>fault tolerance</strong> using user-defined retries and timeouts for each call, registering <strong> asynchronous procedures</strong>. The features and their usage are explained in detail on the <a href="http://code.google.com/p/pmrpc/wiki/PmrpcApiDocs" target="_blank">pmrpc API docs page</a> and a <a href="http://docs.google.com/present/view?id=dctznkrh_677n8758gf8" target="_blank">short presentation</a>, so I'll just give an <strong>example of an advanced pmrpc call</strong>:   1. First, a synchronous procedure named "HelloPMRPC" accessible from windows and iframes loaded from any page on "http://www.myFriendlyDomain1.com" or exactly from the "http://www.myFriendlyDomain2.com" page is registered:    </p>
<pre style="padding-left:30px;"><pre class="brush: jscript; title: ; notranslate">
// [window object A] exposes a procedure in it's window
var publicProcedureName = &quot;HelloPMRPC&quot;;
var procedure = function (alertText) { alert(alertText); return &quot;Hello!&quot;; };
var accessControlList = {
  whitelist : [&quot;http://www.myFriendlyDomain1.com*&quot;, &quot;http://www.myFriendlyDomain2.com&quot;],
  blacklist : []
};

pmrpc.register( {
  &quot;publicProcedureName&quot; : publicProcedureName,
  &quot;procedure&quot; : procedure,
  &quot;acl&quot; : accessControlList
} );
</pre>
<p> 2. Second, the procedure "HelloPMRPC" is called with a single positional parameter "Hello world from pmrpc client!". In case of success, the return value will be alerted while in case of errors the error description will be alerted. The call will be retried up to 15 times, waiting 1500 milliseconds between retries. Windows or iFrames loaded from any domain, except from <a href="http://evil.com" rel="nofollow">http://evil.com</a>, may process the call:    </p>
<pre style="padding-left:30px;"><pre class="brush: jscript; title: ; notranslate">
// [window object B] calls the exposed procedure remotely, from its own window
var parameters = {
  destination : window.frames[&quot;targetIframeName&quot;],
  publicProcedureName : &quot;HelloPMRPC&quot;,
  params : [&quot;Hello world from pmrpc client!&quot;],
  onError : function(statusObj) {alert(statusObj.description);},
  retries : 15,
  timeout : 1500,
  destinationDomain :  {  whitelist : [&quot;*&quot;],  blacklist : [&quot;http://evil.com*&quot;] }
};

pmrpc.call(parameters);
</pre>
<p> Pmrpc is an <strong>open-source project</strong> developed by <a href="http://mivankovic.blogspot.com/2009/10/pmrpc.html" target="_blank">Marko Ivankovic</a> and <a href="http://www.google.com/profiles/izuzak" target="_blank">myself</a> and is available under the <strong>Apache v2.0 license</strong>. The library works in <strong>all web browsers</strong> that implement the postMessage API (Firefox 3, Google Chrome, Internet Explorer 8). For more information please visit the <a href="http://code.google.com/p/pmrpc" target="_blank"><strong>project homepage on Google Code</strong></a> and the <a href="http://code.google.com/p/pmrpc/wiki/PmrpcApiDocs" target="_blank"><strong>API docs page</strong></a> for a full description of the API, feature list and usage examples.   I'll end this post with a few <strong>ideas on making pmrpc even better</strong>:   1. <strong>discovery</strong> - currently, in order to call a remote procedure one needs to have a reference to a window that exposes that procedure. Sometimes obtaining a reference to a window is not very practical and easy (or possible) and a way to find windows by various criteria is needed. For example, discover all windows with a specific name or location or discover windows that expose a procedure with a specific name.  2. <strong>web workers</strong> - <a href="http://www.whatwg.org/specs/web-workers/current-work/" target="_blank">web workers</a> are another specification being developed in parallel with HTML5. The specification "defines an API for running scripts in the background independently of any user interface scripts". What's interesting is that the postMessage API is used to communicate with web workers and therefor pmrpc could be extended to include support for web workers.  3. <strong>publish-subscribe mechanism</strong> - there are lots of communication models other than remote procedure call. One of the most popular models is <a href="http://en.wikipedia.org/wiki/Publish/subscribe" target="_blank">publish-subscribe</a> in which publishers publish events on channels and subscribers subscribe for events on these channels. Messages are delivered from publishers to subscribers without having a direct reference to each other.   I'd appreciate any feedback on pmrpc and our ideas for future work. What are your ideas for the future of inter-window communication? <a href="http://www.twitter.com/izuzak" target="_blank">@izuzak</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://izuzak.wordpress.com/2009/10/10/inter-window-browser-communication-and-how-to-make-it-better/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">35</post-id>
		<media:content medium="image" url="https://1.gravatar.com/avatar/db8f5d658a8f5bfd6ed0442054eb545bfa58ae59aabb92e6495f372966d0d3de?s=96&amp;d=https%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96">
			<media:title type="html">izuzak</media:title>
		</media:content>

		<media:content medium="image" url="http://images.trustedreviews.com/images/article/inline/4513-igoogle.jpg">
			<media:title type="html">iGoogle</media:title>
		</media:content>

		<media:content medium="image" url="http://www.newsgeek.co.il/wp-content/uploads/2009/06/html5-logo.jpg">
			<media:title type="html">HTML5 logo</media:title>
		</media:content>

		<media:content medium="image" url="http://code.google.com/p/pmrpc/logo?logo_id=1248529567">
			<media:title type="html">pmrpc logo</media:title>
		</media:content>
	<enclosure length="3665793" type="application/pdf" url="http://seclab.stanford.edu/websec/frames/post-message.pdf"/><itunes:explicit>no</itunes:explicit><itunes:subtitle>Pmrpc is a JavaScript library for advanced inter-window cross-domain communication. The library utilizes the postMessage API as an underlying communication mechanism and extends it to a remote procedure call (RPC) model using JSON-RPC. JSON-RPC is a transport-independent protocol that uses the JSON data format for formatting messages. The pmrpc library provides a simple API for exposing and calling procedures from windows or iFrames on different domains. Furthermore, pmrpc also provides several features for advanced communication: callbacks for successful and unsuccessful calls, access control lists on both the client and server side, fault tolerance using user-defined retries and timeouts for each call, registering asychronous procedures.</itunes:subtitle><itunes:summary>Pmrpc is a JavaScript library for advanced inter-window cross-domain communication. The library utilizes the postMessage API as an underlying communication mechanism and extends it to a remote procedure call (RPC) model using JSON-RPC. JSON-RPC is a transport-independent protocol that uses the JSON data format for formatting messages. The pmrpc library provides a simple API for exposing and calling procedures from windows or iFrames on different domains. Furthermore, pmrpc also provides several features for advanced communication: callbacks for successful and unsuccessful calls, access control lists on both the client and server side, fault tolerance using user-defined retries and timeouts for each call, registering asychronous procedures.</itunes:summary><itunes:keywords>web development, access control, browser, communication, html5, inter-iframe, inter-widget, inter-window, json, json-rpc, postmessage, remote procedure call, rpc, security</itunes:keywords></item>
		<item>
		<title>A better future for the FriendFeed tools and services ecosystem</title>
		<link>https://izuzak.wordpress.com/2009/09/02/a-better-future-for-the-friendfeed-tools-and-services-ecosystem/</link>
					<comments>https://izuzak.wordpress.com/2009/09/02/a-better-future-for-the-friendfeed-tools-and-services-ecosystem/#respond</comments>
		
		<dc:creator><![CDATA[Ivan Zuzak]]></dc:creator>
		<pubDate>Wed, 02 Sep 2009 19:22:38 +0000</pubDate>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[developers]]></category>
		<category><![CDATA[friendfeed]]></category>
		<guid isPermaLink="false">http://izuzak.wordpress.com/?p=86</guid>

					<description><![CDATA[However, what I don't like about the ecosystem is the separation of developers which develop tools and their potential users. 

Enter FF tools and services - a new FriendFeed group for both developers and users to discuss existing and future FF-related tools and services. The goals I hope the group will help catalyze are: 1) establish a central place where both developers and users of FriendFeed tools can go to sync up and discuss ideas, 2) compile a single list of all FriendFeed tools and services - if you know or use a FF-related web app, bookmarklet or user script - just add it to this list and other users can use it to find cool apps, 3) compile a single list of suggestions for future FriendFeed tools and services - if you have an idea for a cool FF web app or service which doesn't yet exist - just add it to this list and a developer with some free time might build it.]]></description>
										<content:encoded><![CDATA[<p><em><strong>This blog has moved to a <a href="http://ivanzuzak.info">new domain</a>. You can view this post <a href="http://ivanzuzak.info/2009/09/02/a-better-future-for-the-friendfeed-tools-and-services-ecosystem.html">here</a>.<br />
</strong></em></p>
<p><a href="http://friendfeed.com/fftools"><img loading="lazy" class="alignleft" style="margin:5px;" title="FFtools" src="http://friendfeed-media.com/p-ec49d82ba56b40f7a52b7fc838a84d44-large-1000" alt="" width="75" height="75" /></a><a href="http://friendfeed.com" target="_blank">FriendFeed</a> is the only social-networking application I <em>get</em> and like using, and one of the reasons why is that it&#8217;s very community-oriented. The <em>groups </em>and <em>friends </em>approach of segmentation of attention easily directs both topic-oriented discussions and friends-oriented discussions towards the right people.</p>
<p>One other nice thing about FriendFeed is that, although not as popular as Twitter or Facebook, it has a healthy ecosystem of developers extending and building upon the platform.  Lots of great <a href="http://wittman.org/projects/friendfeedtranslate/install/index.html" target="_blank">user scripts</a>, <a href="http://ffcheck.com/" target="_blank">bookmarklets</a>, <a href="http://code.google.com/p/feed-buster" target="_blank">feed-processing services</a>, <a href="http://ffsms.com/">sms services</a> and <a href="http://www.ffholic.com/" target="_blank">web apps</a> have been developed and recently even more so with the release of the <a href="http://friendfeed.com/api/documentation" target="_blank">new API</a>.</p>
<p>However, what I don&#8217;t like about the ecosystem is the separation of developers which develop tools and their potential users. Developers mostly use the official <a href="http://groups.google.com/group/friendfeed-api" target="_blank">FriendFeed API Google group</a> and <a href="http://friendfeed.com/friendfeed-api" target="_blank">FriendFeed API group</a> for discussing programming issues and the API, while non-programmers mostly join the <a href="http://groups.google.com/group/friendfeed" target="_blank">FriendFeed Google group</a> and the <a href="http://friendfeed.com/friendfeed-feedback" target="_blank">FriendFeed Feedback</a> and <a href="http://friendfeed.com/friendfeed-beginners" target="_blank">FriendFeed for beginners</a> FF groups. This definitely isn&#8217;t the best solution for the future of the ecosystem. There is no central hub for the exchange of ideas between users and developers &#8211; users have a hard time finding existing tools and suggesting new ones while developers are have a hard time finding out what users need.</p>
<p>Enter <a href="http://friendfeed.com/fftools" target="_blank"><strong>FF tools and services</strong></a> &#8211; a new FriendFeed group for both developers and users to discuss existing and future FF-related tools and services. The goals I hope the group will help catalyze are:</p>
<ol>
<li>establish a central place where <strong>both developers and users</strong> of FriendFeed tools can go to sync up and discuss ideas,</li>
<li>compile a single <a href="http://friendfeed.com/fftools/119bf1b1/list-of-ff-tools-and-services" target="_blank"><strong>list of all FriendFeed tools and services</strong></a> &#8211; if you know or use a FF-related web app, bookmarklet or user script &#8211; just add it to this list and other users can use it to find cool apps,</li>
<li>compile a single <a href="http://friendfeed.com/fftools/f5e50b9b/have-idea-for-cool-ff-web-app-or-service-add-your" target="_blank"><strong>list of suggestions for future FriendFeed tools and services</strong></a> &#8211; if you have an idea for a cool FF web app or service which doesn&#8217;t yet exist &#8211; just add it to this list and a developer with some free time might build it.</li>
</ol>
<p>And that&#8217;s it &#8211; a place where the FriendFeed tools and services ecosystem can grow. <a href="http://twitter.com/izuzak" target="_blank">@izuzak</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://izuzak.wordpress.com/2009/09/02/a-better-future-for-the-friendfeed-tools-and-services-ecosystem/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">86</post-id>
		<media:content medium="image" url="https://1.gravatar.com/avatar/db8f5d658a8f5bfd6ed0442054eb545bfa58ae59aabb92e6495f372966d0d3de?s=96&amp;d=https%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96">
			<media:title type="html">izuzak</media:title>
		</media:content>

		<media:content medium="image" url="http://friendfeed-media.com/p-ec49d82ba56b40f7a52b7fc838a84d44-large-1000">
			<media:title type="html">FFtools</media:title>
		</media:content>
	</item>
		<item>
		<title>How to supercharge your free AppEngine quota?</title>
		<link>https://izuzak.wordpress.com/2009/08/27/how-to-supercharge-your-free-appengine-quota/</link>
					<comments>https://izuzak.wordpress.com/2009/08/27/how-to-supercharge-your-free-appengine-quota/#comments</comments>
		
		<dc:creator><![CDATA[Ivan Zuzak]]></dc:creator>
		<pubDate>Thu, 27 Aug 2009 12:24:24 +0000</pubDate>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[appengine]]></category>
		<category><![CDATA[cloud computing]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[quota]]></category>
		<category><![CDATA[webapps]]></category>
		<guid isPermaLink="false">http://izuzak.wordpress.com/?p=51</guid>

					<description><![CDATA[Other than billable quotas, there are also unbillable quotas which increase when you switch to the paid model but are not billed.

So here's the idea for supercharging your free AppEngine quotas: 1) switch you app to the paid model by enabling billing, 2) enter the minimum daily budget ($1), 3) distribute the budget over resources you are 100% sure will not consume their free quota (e.g. if you have a stateless app which doesn't use the database, put the whole $1 in the stored data quota).

Since you put your budget on resources which won't consume the entire free quota and since AppEngine doesn't charge you anything if the app doesn't step over the free quota - you are essentially getting a better free quota.]]></description>
										<content:encoded><![CDATA[<p><em><strong>This blog has moved to a <a href="http://ivanzuzak.info">new domain</a>. You can view this post <a href="http://ivanzuzak.info/2009/08/27/how-to-supercharge-your-free-appengine-quota.html">here</a>. </strong></em></p>
<p><a href="http://code.google.com/appengine/" target="_blank">AppEngine</a> is <strong>awesome</strong>! Google&#8217;s cloud computing platform is hosting countless web apps, from <a href="http://moderator.appspot.com/" target="_blank">Google</a> <a href="http://pubsubhubbub.appspot.com/" target="_blank">products</a> to innovative <a href="http://appgallery.appspot.com/" target="_blank">personal projects</a>, and is constantly being upgraded with cool <a href="http://code.google.com/appengine/docs/roadmap.html" target="_blank">new features</a>. <span style="background-color:#ffffff;">And best of all, AppEngine charges for resources (computing, storage and bandwidth) using a <a href="http://en.wikipedia.org/wiki/Freemium" target="_blank"><strong>freemium</strong></a><strong> </strong>pricing model:</span></p>
<p><img loading="lazy" class="alignleft" style="margin:10px;" title="Google AppEngine" src="https://i0.wp.com/code.google.com/appengine/images/appengine_lowres.gif" alt="" width="115" height="88" /><em>&#8220;Each App Engine application can consume a certain level of computing resources for free, controlled by a set of </em><a style="color:#0000cc;" href="http://code.google.com/appengine/docs/quotas.html"><em>quotas</em></a><em>. Developers who want to grow their applications beyond these </em><strong><em>free quotas</em></strong><em> can do so by enabling </em><strong><em>billing </em></strong><em>for their application and set a daily resource budget, which will allow for the purchasing of additional resources if and when they are needed.&#8221;</em></p>
<p>For example, the default free quota has a daily limit of 6.5 hours of CPU time with a maximum rate of 15 CPU-minutes/minute, while the billing enabled quota has 6.5 hours of free CPU time plus a maximum of 1,729 hours of paid CPU time with a maximum rate of 72 CPU-minutes/minute.</p>
<p><a href="http://code.google.com/appengine/docs/billing.html" target="_blank">Billing</a> for paid resources is controlled with a <strong>daily budget</strong> which developers set for each of their applications. The daily budget controls the amount of extra resources which may be purchased each day if the app steps over the free quota. The application developer defines how the daily budget is split between each of the <strong>billable quotas</strong> &#8211; outgoing bandwidth, incoming bandwidth, CPU time, stored data and number of recipients emailed. For example, <strong>$1 </strong>(the minimum daily budget) gets you 5 more CPU hours ($0.10 per CPU hour) and <strong>4 more GB of outgoing bandwidth </strong>($0.12 per GB).</p>
<p>Other than billable quotas, there are also <strong>unbillable quotas</strong> which increase when you switch to the paid model but are not billed. So, <strong>by switching to the paid model, irregardless to how you distribute your budget, your app gets a free</strong><strong> bump</strong><em> </em>in the:</p>
<ul>
<li>number of requests it can process from <strong>1,300,000</strong> to <strong>43,000,000</strong> and from <strong>7,400</strong> to <strong>30,000</strong> req/min,</li>
<li>number of outgoing HTTP requests from <strong>657,000</strong> to <strong>46,000,000</strong> and from <strong>3,000</strong> to <strong>32,000</strong> req/min,</li>
<li>number of memcache calls from <strong>8,600,000 </strong>to <strong>96,000,000</strong> and from <strong>48,000</strong> to <strong>108,000</strong> calls/min,</li>
</ul>
<p>and many others. These are very usable improvements by themselves for apps that need to process a lot of requests (or bursts of requests) which don&#8217;t consume a lot of CPU time, or apps that need to make a lot of outgoing HTTP requests that don&#8217;t consume a lot of bandwidth.</p>
<p>So here&#8217;s the idea for <strong>supercharging your free AppEngine quotas</strong>:</p>
<ol>
<li>switch you app to the paid model by enabling billing,</li>
<li>enter the minimum daily budget ($1),</li>
<li>distribute the budget over resources you are 100% sure will not consume their free quota (e.g. if you have a stateless app which doesn&#8217;t use the database, put the whole $1 in the stored data quota).</li>
</ol>
<p>Since you put your budget on resources which won&#8217;t consume the entire free quota and since AppEngine doesn&#8217;t charge you anything if the app doesn&#8217;t step over the free quota &#8211; you are essentially getting a <strong>better free quota</strong>.</p>
<p><em><strong>EDIT (Sept 5 2009):</strong></em> Yesterday, a week after my original post, Google released AppEngine SDK 1.2.5 which includes a major feature a lot of developers have been waiting for &#8211; <strong>XMPP support</strong>. What&#8217;s interesting and relevant for this post is that XMPP has <a href="http://code.google.com/appengine/docs/quotas.html#XMPP">it&#8217;s own quotas</a> for the number of API calls, data sent, recipients messaged and invitations sent, and &#8211; <strong>none of these quotas are marked as billable</strong>. Therefore, using the recipe for supercharging your free quota will also get you a significant boost in your XMPP quotas (657k -&gt; 46000k API calls, 657k -&gt; 46000k recipients messaged and 1k -&gt; 100k invitations sent). Pretty cool!</p>
<p><em><strong>EDIT (Nov 2 2009):</strong></em> I just noticed that it is <strong>possible to increase the limit on the number of apps each AppEngine user can create</strong>. Currently, each user may create up to 10 AppEngine apps and there was no way to create more when you reached the limit, even by paying (or was there?). However, Google engineers have been approving explicit user requests for increases in the number of apps created <a href="http://groups.google.com/group/google-appengine/browse_thread/thread/210ebae3dc88cc6a?hl=en">on the official AppEngine group</a>. People who have requested an increase have had the limit set to 20 apps.</p>
<p>Are there any other hacks for squeezing more out of AppEngine?  <a href="http://twitter.com/izuzak" target="_blank">@izuzak</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://izuzak.wordpress.com/2009/08/27/how-to-supercharge-your-free-appengine-quota/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">51</post-id>
		<media:content medium="image" url="https://1.gravatar.com/avatar/db8f5d658a8f5bfd6ed0442054eb545bfa58ae59aabb92e6495f372966d0d3de?s=96&amp;d=https%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96">
			<media:title type="html">izuzak</media:title>
		</media:content>

		<media:content medium="image" url="http://code.google.com/appengine/images/appengine_lowres.gif">
			<media:title type="html">Google AppEngine</media:title>
		</media:content>
	</item>
		<item>
		<title>Named arguments in JavaScript</title>
		<link>https://izuzak.wordpress.com/2009/08/09/named-arguments-in-javascript/</link>
					<comments>https://izuzak.wordpress.com/2009/08/09/named-arguments-in-javascript/#comments</comments>
		
		<dc:creator><![CDATA[Ivan Zuzak]]></dc:creator>
		<pubDate>Sun, 09 Aug 2009 18:05:06 +0000</pubDate>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[named arguments]]></category>
		<category><![CDATA[pmrpc]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web]]></category>
		<guid isPermaLink="false">http://izuzak.wordpress.com/?p=18</guid>

					<description><![CDATA[While working on another project (pmrpc, which I will write about soon), the implementation of a feature came down to calling JavaScript functions with named arguments. Unfortunately, the JavaScript language (or EcmaScript to be exact) doesn't support named arguments, rather only positional arguments.

What I came up with (code presented below) is based on the following: 1) using the toString method of the Function prototype, it is possible to retrieve a string representation of any function definition, 2) from the string representation, it is possible to parse the number, order and names of function parameters, 3) from a dictionary of named arguments, it is possible to construct an array of arguments in the correct order using the parsed representation, 4) using the apply method of the Function prototype, it is possible to dynamically call a function, passing an array of arguments instead of an argument list.
]]></description>
										<content:encoded><![CDATA[<p><em><strong>This blog has moved to a <a href="http://ivanzuzak.info">new domain</a>. You can view this post <a href="http://ivanzuzak.info/2009/08/09/named-arguments-in-javascript.html">here</a>. </strong></em></p>
<p>While working on another project (<a title="pmrpc" href="http://code.google.com/p/pmrpc" target="_blank">pmrpc</a>, which I will write about soon), the implementation of a feature came down to calling JavaScript functions with <a href="http://en.wikipedia.org/wiki/Named_parameter" target="_blank">named arguments</a>. Unfortunately, the JavaScript language (or EcmaScript to be exact) <a href="http://ajaxian.com/archives/chrome-extension-api-how-we-wish-we-have-named-parameters">doesn&#8217;t support named arguments</a>, rather only positional arguments.</p>
<p><a href="http://www.javascriptkit.com/javatutors/namedfunction.shtml" target="_blank">Usually</a>, JavaScript developers get around this by defining functions to accept a single object argument which acts like a container for all other named parameters:</p>
<pre class="brush: jscript; title: ; notranslate">
// params is a container for other named parameters
function callMe(params) {
  var param1 = params['param1'];
  var param2 = params['param2'];
  var param3 = params['param3'];

  // do something...
}

var result = callMe({ 'param3' : 1, 'param1' : 2, 'param2' : 3 });
</pre>
<p>This solution works nicely when you are in the position to modify every function to be called this way. However, this is not always the case (e.g. when using external libraries), and also isn&#8217;t as readable as having a proper parameter list, and introduces code overhead in every function that implements this principle. What I needed for my project is something that enables calling any JavaScript function with named arguments, without modifying the function itself.</p>
<p>What I came up with (code presented below) is based on the following:</p>
<ol>
<li>using the <em>toString </em>method of the Function prototype, it is possible to retrieve a string representation of any function definition</li>
<li>from the string representation, it is possible to parse the number, order and names of function parameters</li>
<li>from a dictionary of named arguments, it is possible to construct an array of arguments in the correct order using the parsed representation</li>
<li>using the <em>apply </em>method of the Function prototype, it is possible to dynamically call a function, passing an array of arguments instead of an argument list.</li>
</ol>
<pre class="brush: jscript; title: ; notranslate">
// calls function fn with context self and parameters defined in dictionary namedParams
function callWithNamedArgs( fn, self, namedParams ) {
  // get string representation of function
  var fnDef = fn.toString();

  // parse the string representation and retrieve order of parameters
  var argNames = fnDef.substring(fnDef.indexOf(&quot;(&quot;)+1, fnDef.indexOf(&quot;)&quot;));
  argNames = (argNames === &quot;&quot;) ? [] : argNames.split(&quot;, &quot;);
  var argIndexes = {};
  for (var i=0; i&lt;argNames.length; i++) {
    argIndexes[argNames[i]] = i;
  }

  // construct an array of arguments from a dictionary
  var callParameters = [];
  for (paramName in namedParams) {
    if (argIndexes[paramName]) {
      callParameters[argIndexes[paramName]] = namedParams[paramName];
    }
  }

  // invoke function with specified context and arguments array
  return fn.apply(self, callParameters);
}

// example function
function callMe(param1, param2, param3) {
  // do something ...
}

// example invocation with named parameters
var result = callWithNamedArgs(callMe, this, { 'param3' : 1, 'param1' : 2, 'param2' : 3 });
</pre>
<p>This could also have been implemented as a Function prototype method and be called directly on a function object, which would simplify usage since the target function parameter wouldn&#8217;t have to be passed. But, if the <em>CallWithNamedArgs</em> function indeed was implemented prototype function, could the context parameter be removed also? I.e. is it possible to retrieve the current execution context (<em>this </em>object) of the target function within the <em>CallWithNamedArgs </em>method? The problem is that the execution context within the <em>CallWithNamedArgs method </em>is the Function object on which the <em>CallWithNamedArgs </em>method was called. But what we need is the execution context of the target function, which is the Function object on which the <em>CallWithNamedArgs </em>method was called. That is, what we need is the current execution context of the parent object. Any ideas? <a href="http://twitter.com/izuzak">@izuzak</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://izuzak.wordpress.com/2009/08/09/named-arguments-in-javascript/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">18</post-id>
		<media:content medium="image" url="https://1.gravatar.com/avatar/db8f5d658a8f5bfd6ed0442054eb545bfa58ae59aabb92e6495f372966d0d3de?s=96&amp;d=https%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96">
			<media:title type="html">izuzak</media:title>
		</media:content>
	</item>
	</channel>
</rss>