<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>strayorange &#187; dht</title>
	<atom:link href="http://www.strayorange.com/blog/tag/dht/feed" rel="self" type="application/rss+xml" />
	<link>http://www.strayorange.com/blog</link>
	<description>where may I find stray oranges, sir?</description>
	<lastBuildDate>Tue, 10 Aug 2010 13:13:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>HTML5 Web Sockets API reloaded</title>
		<link>http://www.strayorange.com/blog/164-html5-web-sockets-api-reloaded</link>
		<comments>http://www.strayorange.com/blog/164-html5-web-sockets-api-reloaded#comments</comments>
		<pubDate>Thu, 10 Sep 2009 15:17:59 +0000</pubDate>
		<dc:creator>CAFxX</dc:creator>
				<category><![CDATA[CAFxX]]></category>
		<category><![CDATA[dht]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[whatwg]]></category>

		<guid isPermaLink="false">http://www.strayorange.com/blog/?p=164</guid>
		<description><![CDATA[One of the most exciting upcoming features of HTML5 is the ability to open persistent bidirectional sockets to a remote host. As far as I know, one of the early proposals was about allowing web applications almost complete control over sockets, including the ability to create raw sockets and to listen for incoming connections exactly [...]


Related posts:<ol><li><a href='http://www.strayorange.com/blog/247-dragdrop-not-really-working-properly-in-imagetweak' rel='bookmark' title='Permanent Link: Drag&#038;drop not really working properly in ImageTweak'>Drag&#038;drop not really working properly in ImageTweak</a> <small>When I released ImageTweak 0.19 I wrote in the changelog...</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>One of the most exciting upcoming features of HTML5 is the ability to <a href="http://dev.w3.org/html5/websockets/">open persistent bidirectional sockets to a remote host</a>.</p>
<p>As far as I know, <a href="http://www.w3.org/TR/2008/WD-html5-20080122/#network">one of the early proposals</a> was about allowing web applications almost complete control over sockets, including the ability to create raw sockets and to listen for incoming connections exactly like a typical network daemon/server, but this proposal was later scraped because of <a href="http://cometdaily.com/2008/07/04/html5-websocket/">security implications</a>.</p>
<p>Fast forward to today and the Web Sockets API, even if still under development, are starting to get a stable shape and they will probably be implemented soon by the most forward-looking browser vendors.</p>
<p>The problem is, though, that the original proposal got crampled along the way and therefore there won&#8217;t be any means to create peer-to-peer connections between users, something that could enable <a href="http://www.strayorange.com/blog/56-a-dht-for-mozilla">all kinds of cool distributed systems</a>.</p>
<p>That is, unless someone does something: what I&#8217;m thinking about right now is a kind of wrapper/extension around the Web Sockets API that does simply a few things:</p>
<ol>
<li>allows a web application to register for incoming connections</li>
<li>opens up the required ports on the firewall/NAT</li>
<li>when a connection arrives, perform the handshaking required by the ws:// protocol and forwards a WebSocket object representing the connection to the application</li>
</ol>
<p>Talking IDL, that would mean (the WebSocket interface is the current WHATWG proposal, while WebSocketListener is my addition):</p>
<pre>[Constructor(in DOMString url, optional in DOMString protocol)]
interface WebSocket {
  readonly attribute DOMString URL;

  // ready state
  const unsigned short CONNECTING = 0;
  const unsigned short OPEN = 1;
  const unsigned short CLOSED = 2;
  readonly attribute unsigned short readyState;
  readonly attribute unsigned long bufferedAmount;

  // networking
           attribute Function onopen;
           attribute Function onmessage;
           attribute Function onclose;
  boolean send(in DOMString data);
  void close();
};

[Constructor(optional in short port, optional in DOMString protocol)]
interface WebSocketListener {
  readonly attribute short port;

  // ready state
  const unsigned short OPENING = 0;
  const unsigned short LISTENING = 1;
  const unsigned short CLOSED = 2;
  readonly attribute unsigned short readyState;

  // networking
           attribute Function onconnection;
  void close();
};</pre>
<p>Talking about the Mozilla platform, points 1 and 3 are straightforward (once the Web Sockets API has been implemented), whereas point 2 will be platform-dependent and, therefore, trickier. Nevertheless, I think that all of this can be handled (with some work) by a Firefox extension.</p>
<p>Once Firefox will gain Web Sockets support I&#8217;ll definitely try to see if it is possible to add it.</p>


<p>Related posts:<ol><li><a href='http://www.strayorange.com/blog/247-dragdrop-not-really-working-properly-in-imagetweak' rel='bookmark' title='Permanent Link: Drag&#038;drop not really working properly in ImageTweak'>Drag&#038;drop not really working properly in ImageTweak</a> <small>When I released ImageTweak 0.19 I wrote in the changelog...</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.strayorange.com/blog/164-html5-web-sockets-api-reloaded/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A DHT for Mozilla?</title>
		<link>http://www.strayorange.com/blog/56-a-dht-for-mozilla</link>
		<comments>http://www.strayorange.com/blog/56-a-dht-for-mozilla#comments</comments>
		<pubDate>Wed, 01 Apr 2009 14:19:19 +0000</pubDate>
		<dc:creator>CAFxX</dc:creator>
				<category><![CDATA[CAFxX]]></category>
		<category><![CDATA[dht]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[songbird]]></category>

		<guid isPermaLink="false">http://www.strayorange.com/blog/?p=56</guid>
		<description><![CDATA[I&#8217;ve been thinking in the last few days about writing a DHT implementation for Mozilla, some kind of generic library (packaged as an add-on) that may be used in a tons of different ways, like: a distributed version of Weave (for Firefox) a shared cache/proxy/CDN system (that would allow users to reach otherwise unreachable resources, [...]


Related posts:<ol><li><a href='http://www.strayorange.com/blog/164-html5-web-sockets-api-reloaded' rel='bookmark' title='Permanent Link: HTML5 Web Sockets API reloaded'>HTML5 Web Sockets API reloaded</a> <small>One of the most exciting upcoming features of HTML5 is...</small></li>
<li><a href='http://www.strayorange.com/blog/175-social-networks-3-0' rel='bookmark' title='Permanent Link: Social networks 3.0?'>Social networks 3.0?</a> <small>Hello everybody, this is my first post on this blog....</small></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been thinking in the last few days about writing a DHT implementation for Mozilla, some kind of generic library (packaged as an add-on) that may be used in a tons of different ways, like:</p>
<ul>
<li>a distributed version of Weave (for Firefox)</li>
<li>a shared cache/proxy/CDN system (that would allow users to reach otherwise unreachable resources, be it because of server downtime or because of censorship policies)</li>
<li>a file sharing platform (for Songbird: imagine being able to see in your library not only your songs, but also everyone else&#8217;s)</li>
<li>a distributed computing platform (more on this in a later post)</li>
<li>the Next Big Thing™</li>
</ul>
<p>BTW, much of this is partly already implemented in any bittorrent client (and the rest is already <a href="http://www.bittorrent.org/beps/bep_0009.html">on track</a>), what&#8217;s needed is just glueing the pieces together. As soon as my exams are over I&#8217;ll give it a try&#8230;</p>


<p>Related posts:<ol><li><a href='http://www.strayorange.com/blog/164-html5-web-sockets-api-reloaded' rel='bookmark' title='Permanent Link: HTML5 Web Sockets API reloaded'>HTML5 Web Sockets API reloaded</a> <small>One of the most exciting upcoming features of HTML5 is...</small></li>
<li><a href='http://www.strayorange.com/blog/175-social-networks-3-0' rel='bookmark' title='Permanent Link: Social networks 3.0?'>Social networks 3.0?</a> <small>Hello everybody, this is my first post on this blog....</small></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.strayorange.com/blog/56-a-dht-for-mozilla/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
