<?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>Steve Vinoski's Blog &#187; yaws</title>
	<atom:link href="http://steve.vinoski.net/blog/category/yaws/feed/" rel="self" type="application/rss+xml" />
	<link>http://steve.vinoski.net/blog</link>
	<description>Ask forgiveness, not permission.</description>
	<lastBuildDate>Thu, 09 May 2013 03:00:44 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>New Column: Server-Sent Events with Yaws</title>
		<link>http://steve.vinoski.net/blog/2012/10/08/new-column-server-sent-events-with-yaws/</link>
		<comments>http://steve.vinoski.net/blog/2012/10/08/new-column-server-sent-events-with-yaws/#comments</comments>
		<pubDate>Mon, 08 Oct 2012 17:35:08 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[column]]></category>
		<category><![CDATA[erlang]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[notifications]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[yaws]]></category>
		<category><![CDATA[polling]]></category>
		<category><![CDATA[server-sent-events]]></category>

		<guid isPermaLink="false">http://steve.vinoski.net/blog/?p=1079</guid>
		<description><![CDATA[My latest Internet Computing column, Server-Sent Events with Yaws (PDF), is now available. It discusses the fact that developers are increasingly building Web applications that rely on notifications from the server, such as updates from social networks, alerts from application monitors, or information from sensor networks. But given that HTTP is a request-response protocol, such [...]]]></description>
				<content:encoded><![CDATA[<p>My latest Internet Computing column, <a href="http://steve.vinoski.net/pdf/IC-SSE_with_Yaws.pdf">Server-Sent Events with Yaws</a> (PDF), is now available. It discusses the fact that developers are increasingly building Web applications that rely on notifications from the server, such as updates from social networks, alerts from application monitors, or information from sensor networks. But given that HTTP is a request-response protocol, such notifications can be challenging, giving rise to techniques such as long polling and to entirely new protocols such as <a href="http://tools.ietf.org/html/rfc6455">WebSocket</a>. These challenges can be especially significant for mobile applications due to intermittent client connectivity and device battery-life issues. This column explores how the <a href="http://yaws.hyber.org/">Yaws Web server</a>, written in the <a href="http://www.erlang.org/">Erlang programming language</a>, supports the <a href="http://www.w3.org/TR/eventsource/">W3C Server-Sent Events</a> notification approach.</p>
]]></content:encoded>
			<wfw:commentRss>http://steve.vinoski.net/blog/2012/10/08/new-column-server-sent-events-with-yaws/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Column: Yaws</title>
		<link>http://steve.vinoski.net/blog/2011/07/01/new-column-yaws/</link>
		<comments>http://steve.vinoski.net/blog/2011/07/01/new-column-yaws/#comments</comments>
		<pubDate>Fri, 01 Jul 2011 19:51:57 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[column]]></category>
		<category><![CDATA[erlang]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[yaws]]></category>

		<guid isPermaLink="false">http://steve.vinoski.net/blog/?p=845</guid>
		<description><![CDATA[The July/August 2011 issue of Internet Computing is out, and this time my column (pdf) covers the Erlang Yaws web server. Since Yaws has too many features to detail in just one column, I wrote it as an introductory piece, covering only those features that are most commonly used. You might also take a look [...]]]></description>
				<content:encoded><![CDATA[<p>The <a href="http://www.computer.org/portal/web/csdl/abs/mags/ic/2011/04/mic201104toc.htm">July/August 2011 issue of Internet Computing</a> is out, and this time <a href="/pdf/IC-Yaws.pdf">my column</a> (pdf) covers the <a href="http://www.erlang.org/">Erlang</a> <a href="http://yaws.hyber.org/">Yaws web server</a>. Since Yaws has too many features to detail in just one column, I wrote it as an introductory piece, covering only those features that are most commonly used.</p>
<p>You might also take a look at my slides from my <a href="http://www.erlang-factory.com/upload/presentations/409/vinoski-ef-london-2011.pdf">&#8220;A Decade of Yaws&#8221;</a> talk (pdf) from Erlang Factory London 2011.</p>
]]></content:encoded>
			<wfw:commentRss>http://steve.vinoski.net/blog/2011/07/01/new-column-yaws/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Media Distribution Talk on InfoQ</title>
		<link>http://steve.vinoski.net/blog/2011/01/10/media-distribution-talk-on-infoq/</link>
		<comments>http://steve.vinoski.net/blog/2011/01/10/media-distribution-talk-on-infoq/#comments</comments>
		<pubDate>Mon, 10 Jan 2011 04:12:38 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[conferences]]></category>
		<category><![CDATA[erlang]]></category>
		<category><![CDATA[functional programming]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[Verivue]]></category>
		<category><![CDATA[yaws]]></category>

		<guid isPermaLink="false">http://steve.vinoski.net/blog/?p=659</guid>
		<description><![CDATA[InfoQ recently posted my keynote from the March 2010 Erlang Factory Bay Area. The keynote, entitled Using Erlang in a Carrier-Grade Media Distribution Switch, presents some of the work my colleagues and I at Verivue have been engaged in over the past few years. Since it was an Erlang conference, the talk naturally focuses on [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.infoq.com/">InfoQ</a> recently posted my keynote from the <a href="http://www.erlang-factory.com/conference/SFBay2010">March 2010 Erlang Factory Bay Area</a>. The keynote, entitled <a href="http://www.infoq.com/presentations/Erlang-Media-Distribution-Switch"><em>Using Erlang in a Carrier-Grade Media Distribution Switch</em></a>, presents some of the work my colleagues and I at <a href="http://www.verivue.com/">Verivue</a> have been engaged in over the past few years. Since it was an Erlang conference, the talk naturally focuses on the Erlang aspects of the work.</p>
]]></content:encoded>
			<wfw:commentRss>http://steve.vinoski.net/blog/2011/01/10/media-distribution-talk-on-infoq/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Yaws 1.85 Released</title>
		<link>http://steve.vinoski.net/blog/2009/10/19/yaws-1-85-released/</link>
		<comments>http://steve.vinoski.net/blog/2009/10/19/yaws-1-85-released/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 22:52:59 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[HTTP]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[yaws]]></category>

		<guid isPermaLink="false">http://steve.vinoski.net/blog/?p=484</guid>
		<description><![CDATA[Today Klacke announced Yaws 1.85, mainly a bugfix release. You can find the list of changes and fixes at that link, but one addition in this release I wanted to point out was our new streamcontent_from_pid feature, which allows your server application code to temporarily take over the client connection socket from Yaws, thus allowing [...]]]></description>
				<content:encoded><![CDATA[<p>Today Klacke announced <a href="http://yaws.hyber.org/">Yaws 1.85</a>, mainly a bugfix release. You can find the list of changes and fixes at that link, but one addition in this release I wanted to point out was our new <code> streamcontent_from_pid</code> feature, which allows your server application code to temporarily take over the client connection socket from Yaws, thus allowing you to feed data directly to the socket without first passing it back through Yaws. Could be just the ticket for long-polling (Comet) applications, for example.</p>
<p>Prior to this release, the closest feature Yaws provided for this sort of operation was the <code>streamcontent</code> capability, which is still very useful in that it allows you to have an Erlang process deliver data back into Yaws, which in turn sends it in HTTP chunked transfer mode back to the client. For large file resources like video files or install tarballs, or for data sources where content arrives at your server in batches from a separate back-end source, or generally for resources whose sizes are not known up front, <code>streamcontent</code> is perfect because it lets you transfer the data back into Yaws in chunks, at your leisure and without having to copy all the data at once. Still, though, the data has to be sent back through Yaws, which converts it to HTTP chunks and writes it to the socket, plus in this case your only choice is chunked transfer.</p>
<p>With <code>streamcontent_from_pid</code>, you reply to the <code>out/1</code> upcall from Yaws with the HTTP reply headers and with the following special return tuple:</p>
<pre><code>{streamcontent_from_pid, MimeType, StreamPid}</code></pre>
<p>This tells Yaws that you wish to have process <code>StreamPid</code> take over the client socket in order to send data of media type <code>MimeType</code> directly back to the client. Yaws uses <code>MimeType</code> to set the HTTP <code>Content-Type</code> header, and then after sending that and all the other HTTP headers back to the client, it turns control of the client socket over to <code>StreamPid</code>. The code running within <code>StreamPid</code> must handle the following messages from Yaws:</p>
<ul>
<li><code>{ok, YawsPid}</code> tells <code>StreamPid</code> that it can proceed with using the socket. The socket is present in the original <code>Arg</code> variable passed to your <code>out/1</code> function and can be retrieved via <code>Arg#arg.clisock</code>.</li>
<li><code>{discard, YawsPid}</code> tells <code>StreamPid</code> that it shouldn&#8217;t send any data on the socket, for example because the client request was an HTTP <code>HEAD</code> request and so there is no response body.</li>
</ul>
<p>To send data, your code can choose to send chunked data or non-chunked data. To send the latter, first make sure you set the HTTP <code>Content-Length</code> header in your initial reply to Yaws, and then once Yaws calls back to your <code>StreamPid</code> process, just call:</p>
<pre><code>yaws_api:stream_process_deliver(Socket, IoList)</code></pre>
<p>or for chunked data:</p>
<pre><code>yaws_api:stream_process_deliver_chunk(Socket, IoList)</code></pre>
<p>where for both cases <code>Socket</code> is the client socket from the <code>Arg</code> and <code>IoList</code> is an iolist containing the data to be sent. The first case just calls <code>gen_tcp:send</code> and is there primarily so we can maybe someday add SSL socket support for this feature. For the second case Yaws will format the data for you for chunked transfer. Unless a <code>Content-Length</code> header is set, Yaws will assume you want chunked transfer and will set the <code>Transfer-Encoding</code> header appropriately. If you&#8217;re sending chunked data, make sure you send your final chunk using the following function:</p>
<pre><code>yaws_api:stream_process_deliver_final_chunk(Socket, IoList)</code></pre>
<p>so that Yaws knows to send the termination chunk to inform the client of the end of the transfer.</p>
<p>You can continue to call these functions from your <code>StreamPid</code> as frequently as you need to in order to deliver your data to the client. Meanwhile, the Yaws process that handed you the socket will just sit back and wait for you (non-blocking, of course). When you&#8217;re completely finished sending, just call:</p>
<pre><code>yaws_api:stream_process_end(Socket, YawsPid)</code></pre>
<p>to end the transmission and give control of the socket back to Yaws. At that point, your <code>StreamPid</code> can exit if it wishes.</p>
<p>If you try out this feature, be sure to send feedback either to me or to the <a href="https://lists.sourceforge.net/lists/listinfo/erlyaws-list">Yaws mailing list</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://steve.vinoski.net/blog/2009/10/19/yaws-1-85-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yaws 1.82</title>
		<link>http://steve.vinoski.net/blog/2009/05/29/yaws-182/</link>
		<comments>http://steve.vinoski.net/blog/2009/05/29/yaws-182/#comments</comments>
		<pubDate>Fri, 29 May 2009 18:21:52 +0000</pubDate>
		<dc:creator>steve</dc:creator>
				<category><![CDATA[erlang]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[yaws]]></category>
		<category><![CDATA[release]]></category>

		<guid isPermaLink="false">http://steve.vinoski.net/blog/?p=425</guid>
		<description><![CDATA[Today Klacke released version 1.82 of Yaws. This is primarily a maintenance release, so nothing major has changed, except that yaws.conf and other files that used to go into etc now go into etc/yaws. For example, the default install prefix is /usr/local so for the installation on my laptop my yaws.conf file has moved from [...]]]></description>
				<content:encoded><![CDATA[<p>Today Klacke released <a href="http://sourceforge.net/mailarchive/forum.php?thread_name=4A1FA196.5060101%40tail-f.com&#038;forum_name=erlyaws-list">version 1.82 of Yaws</a>. This is primarily a maintenance release, so nothing major has changed, except that <code>yaws.conf</code> and other files that used to go into <code>etc</code> now go into <code>etc/yaws</code>. For example, the default install prefix is <code>/usr/local</code> so for the installation on my laptop my <code>yaws.conf</code> file has moved from <code>/usr/local/etc/yaws.conf</code> to <code>/usr/local/etc/yaws/yaws.conf</code>. You&#8217;ll want to make sure you move any existing conf files you might have to the new directory.</p>
<p>Various other changes and bug fixes are described in the <a href="http://yaws.hyber.org/">release notes on the main Yaws website</a>. For the previous release Klacke moved the sources from sourceforge to <a href="http://github.com/klacke/yaws">github</a>, so follow that link if you&#8217;re looking for source, and you can <a href="http://yaws.hyber.org/configuration.yaws">follow these instructions</a> to build, install, and run. If you should run into any issues or problems, please send a message to the <a href="https://lists.sourceforge.net/lists/listinfo/erlyaws-list">Yaws mailing list</a> or create a new issue on the <a href="http://github.com/klacke/yaws/issues">Yaws issue tracker</a>.</p>
<p>As far as planning for the next release goes, aside from the usual little bug fixes and enhancements and adding tests, Klacke and I noticed <a href="http://www.joeandmotorboat.com/">Joe Williams</a>&#8216;s <a href="http://www.slideshare.net/logicalstack/web-server-deathmatch-2009-erlang-factory-joe-williams">recent Erlang Factory presentation</a> that mentions Yaws CPU usage is sometimes higher than expected, so we&#8217;ll be looking into that and doing some general profiling and performance testing work.</p>
]]></content:encoded>
			<wfw:commentRss>http://steve.vinoski.net/blog/2009/05/29/yaws-182/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
