<?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>JimmyLi.net &#187; ajax</title>
	<atom:link href="http://jimmyli.net/tag/ajax/feed/" rel="self" type="application/rss+xml" />
	<link>http://jimmyli.net</link>
	<description>Join the dark side</description>
	<lastBuildDate>Wed, 08 Sep 2010 07:41:53 +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>Guide to Bandwidth in packets</title>
		<link>http://jimmyli.net/2009/10/guide-to-bandwidth-in-packets/</link>
		<comments>http://jimmyli.net/2009/10/guide-to-bandwidth-in-packets/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 02:58:29 +0000</pubDate>
		<dc:creator>Jimmy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[Packets]]></category>
		<category><![CDATA[TCP/IP]]></category>

		<guid isPermaLink="false">http://jimmyli.net/?p=57</guid>
		<description><![CDATA[Yahoo! Developer Network (YDN) posted an interesting blog article about thinking of bandwidth in terms of packets.  Since all HTTP data essentially travel through the Internet by packets (using TCP/IP), it&#8217;s interesting to be more aware of how much data each packet stores.  I don&#8217;t know very much in-depth about TCP/IP but it seems like [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://developer.yahoo.com/" target="_blank">Yahoo! Developer Network</a> (YDN) posted an <a href="http://developer.yahoo.net/blog/archives/2009/10/a_engineers_gui.html" target="_blank">interesting blog article</a> about thinking of bandwidth in terms of packets.  Since all HTTP data essentially travel through the Internet by packets (using <a href="http://en.wikipedia.org/wiki/Tcp/ip" target="_blank">TCP/IP</a>), it&#8217;s interesting to be more aware of how much data each packet stores.  I don&#8217;t know very much in-depth about TCP/IP but it seems like a packet is typically 1460 bytes maximum according to the YDN blog article.</p>
<p>Although trying to optimize your website to use the fewest packets as possible sound absurd, there are actually some areas where doing it may have some small benefits.  For example, small requests that can fall in the 1 or 2 packet segments.  I&#8217;m mainly taking about AJAX (<a href="http://en.wikipedia.org/wiki/Xmlhttprequest" target="_blank">XMLHttpRequest</a>) requests, which we expect the response to be fairly instantaneous.  Every packet sent with TCP/IP has to be acknowledged by the other server and the client has to wait for that acknowledgment, so it is typically slow (more latency) compared to other protocols (such as <a href="http://en.wikipedia.org/wiki/User_Datagram_Protocol" target="_blank">UDP</a>, which is along the lines of fire-and-forget).  Since AJAX requests are typically very small, it is a good area to try to improve it by trying it as small as possible.  This includes its HTTP Header data (cookies, user-agent strings, accept strings, referrers, etc.) and any Body data (POST data).  Most of that data is fairly hard to change since it&#8217;s provided by the browser, but others such as the cookie data and POST data the web developers can.  For me, I try to keep the cookie data as small as possible.  Some web frameworks allow you to store encrypted session data in the user&#8217;s cookie by default (such as <a href="http://kohanaphp.com/" target="_blank">KohanaPHP</a>), which is nice in keeping that data with the user, but it adds that extra data to every request (including non-AJAX requests).  (Though one can argue that accessing the file system or database for the session data could be slower than the extra packet.)  Instead, it maybe recommended to just store the session ID in the browser (which is PHP&#8217;s default behavior).</p>
<p>The blog article also has an interesting link to another <a href="http://josephscott.org/archives/2009/08/xmlhttprequest-xhr-uses-multiple-packets-for-http-post/" target="_blank">interesting article</a> measuring that XMLHttpRequest uses 2 packets to send POST data (for most browsers).  You should give that one a read.  Although I don&#8217;t have websites with huge user-bases that could definitely take advantage of these techniques, it is interesting to know what is going on when the request leaves your web browser and how to optimize it such a minute scale.</p>
]]></content:encoded>
			<wfw:commentRss>http://jimmyli.net/2009/10/guide-to-bandwidth-in-packets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSONRequest Proposal</title>
		<link>http://jimmyli.net/2009/03/jsonrequest-proposal/</link>
		<comments>http://jimmyli.net/2009/03/jsonrequest-proposal/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 07:15:22 +0000</pubDate>
		<dc:creator>Jimmy</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[csrf]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[jsonrequest]]></category>
		<category><![CDATA[xhr]]></category>

		<guid isPermaLink="false">http://jimmyli.net/?p=24</guid>
		<description><![CDATA[For the last year to two I&#8217;ve familiarized myself quite a bit with AJAX and was able to leverage its power in providing a seamless user experience with so-called Web 2.0 style of web development and design.  I&#8217;ve began AJAX with simple XMLHttpRequest (XHR) to request HTTP data from the server.  Then, I&#8217;ve stepped up [...]]]></description>
			<content:encoded><![CDATA[<p>For the last year to two I&#8217;ve familiarized myself quite a bit with <a href="http://en.wikipedia.org/wiki/AJAX" target="_blank">AJAX</a> and was able to leverage its power in providing a seamless user experience with so-called Web 2.0 style of web development and design.  I&#8217;ve began AJAX with simple <a href="http://en.wikipedia.org/wiki/Xmlhttprequest" target="_blank">XMLHttpRequest</a> (XHR) to request HTTP data from the server.  Then, I&#8217;ve stepped up my game and utilized the <a title="jQuery" href="http://jquery.com/" target="_blank">jQuery</a> Javascript Library to do AJAX.  One of the best things I loved was the ability to handle a <a href="http://en.wikipedia.org/wiki/Json" target="_blank">JSON</a> data type request from the server.  Unlike a block of XML or HTML, JSON is so flexible as one is able to return many different types of information such as a status code, status message, and any data along with a HTTP Status Code 200 (OK).  I&#8217;ve pretty much defaulted to using JSON as the response type for all my AJAX called through jQuery.</p>
<p>At work, while working with a third-party application for generating personalized websites, the lack of information the system provided, I&#8217;ve tried using AJAX to request information from another server that can request for more information.  Upon discovering that AJAX cannot perform cross-domain requests (Same Origin Policy) due to various security issues that would arise, I&#8217;ve found something called JSONP.  Although it&#8217;s technically not AJAX (it doesn&#8217;t use the XMLHttpRequest object), it was a workable hack-ish workaround the limitations of the current state of AJAX techniques using a GET request that returns a JSON object wrapped in a Javascript callback function.</p>
<p>Today, I&#8217;ve discovered a <a href="http://www.json.org/JSONRequest.html" target="_blank">proposal  by Douglas Crockford for a JSONRequest service</a> that allows cross-domain requests with requests and responses in the form of JSON, minus some of the issues that plagued XMLHttpRequest if it was usable cross-domain.  The big one would be that cookies or HTTP Authentication data would not be sent along with the request, so that prevents <a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery" target="_blank">Cross-Site Request Forgery</a>.  Though the proposal has been created nearly three years ago I&#8217;m surprised that it hasn&#8217;t been implemented in any browsers yet.  I hope a future version of Firefox or some browser would implement it and slowly spread its implementation.</p>
]]></content:encoded>
			<wfw:commentRss>http://jimmyli.net/2009/03/jsonrequest-proposal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
