<?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>Phil Leggetter - Real-Time Web Software and Technology Evangelist &#187; MSDN</title>
	<atom:link href="http://www.leggetter.co.uk/tag/msdn/feed" rel="self" type="application/rss+xml" />
	<link>http://www.leggetter.co.uk</link>
	<description>Real-Time Web, Real-Time Data and Social Media Software and Technology Evangelist and Consultant</description>
	<lastBuildDate>Sun, 29 Jan 2012 05:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>MSDN e-book and podcast</title>
		<link>http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html</link>
		<comments>http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html#comments</comments>
		<pubDate>Sun, 03 Jan 2010 17:38:17 +0000</pubDate>
		<dc:creator>Phil Leggetter</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[podcast]]></category>
		<category><![CDATA[silverlight]]></category>

		<guid isPermaLink="false">http://www.leggetter.co.uk/?p=629</guid>
		<description><![CDATA[<p>A few months back I wrote an article for the UK MSDN Flash newsletter. That article is now available in a <a href="http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html#ebook">free e-book</a> and my <a href="http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html#podcast">podcast</a> interview about the article with <a href="http://blogs.msdn.com/ericnel/">Eric Nelson</a> is now also available.<br /> <br /> <a name="podcast"></a></p> Podcast <p><a href="http://ecn.channel9.msdn.com/o9/ch9/5/7/6/3/1/5/msdnflash016b.mp3">Phil Leggetter talks about creating a Silverlight application [...]
Related posts:<ol>
<li><a href='http://www.leggetter.co.uk/2010/02/05/silverlight-uses-xcp-tmp-files-for-web-requests.html' rel='bookmark' title='Silverlight uses XCP tmp files for Web Requests'>Silverlight uses XCP tmp files for Web Requests</a></li>
<li><a href='http://www.leggetter.co.uk/2010/09/18/thoughts-on-an-seo-question-raised-in-the-social-media-white-noise-podcast.html' rel='bookmark' title='Thoughts on an SEO question raised in the Social Media White Noise podcast'>Thoughts on an SEO question raised in the Social Media White Noise podcast</a></li>
<li><a href='http://www.leggetter.co.uk/2009/08/05/book-review-juggle-rethink-work-reclaim-your-life.html' rel='bookmark' title='Book review: Juggle! Rethink work, reclaim your life'>Book review: Juggle! Rethink work, reclaim your life</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>A few months back I wrote an article for the UK MSDN Flash newsletter. That article is now available in a <a  href="http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html#ebook">free e-book</a> and my <a  href="http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html#podcast">podcast</a> interview about the article with <a  href="http://blogs.msdn.com/ericnel/">Eric Nelson</a> is now also available.<br />
<span id="more-629"></span><br />
<a name="podcast"></a></p>
<h3>Podcast</h3>
<p><a href="http://ecn.channel9.msdn.com/o9/ch9/5/7/6/3/1/5/msdnflash016b.mp3">Phil Leggetter talks about creating a Silverlight application that consumes real-time data</a></p>
<p>Here&#8217;s a link to Eric&#8217;s <a  href="http://geekswithblogs.net/iupdateable/archive/2009/12/17/msdn-flash-podcast-016-ndash-phil-leggetter-talks-real-time.aspx">original podcast post</a>.</p>
<p><script src="http://mediaplayer.yahoo.com/js" type="text/javascript"></script></p>
<h3>E-Book</h3>
<div id="__ss_2710377" style="width: 477px; text-align: left;"><a  style="font: 14px Helvetica,Arial,Sans-serif; display: block; margin: 12px 0 3px 0; text-decoration: underline;" title="UK MSDN Flash eBook Best Technical Articles #2 - ericnel" href="http://www.slideshare.net/ukdpe/uk-msdn-flash-e-book-best-technical-articles-2-ericnel">UK MSDN Flash eBook Best Technical Articles #2 &#8211; ericnel</a><object style="margin: 0px;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="477" height="510" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayerd.swf?doc=ukmsdnflashebookbesttechnicalarticlesnum2-091213141440-phpapp02&amp;stripped_title=uk-msdn-flash-e-book-best-technical-articles-2-ericnel" /><param name="allowfullscreen" value="true" /><embed style="margin: 0px;" type="application/x-shockwave-flash" width="477" height="510" src="http://static.slidesharecdn.com/swf/ssplayerd.swf?doc=ukmsdnflashebookbesttechnicalarticlesnum2-091213141440-phpapp02&amp;stripped_title=uk-msdn-flash-e-book-best-technical-articles-2-ericnel" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<div style="font-size: 11px; font-family: tahoma,arial; height: 26px; padding-top: 2px;">View more <a  style="text-decoration: underline;" href="http://www.slideshare.net/">documents</a> from <a  style="text-decoration: underline;" href="http://www.slideshare.net/ukdpe">ukdpe</a>.</div>
</div>
<p>Here&#8217;s a link to Eric&#8217;s <a  href="http://geekswithblogs.net/iupdateable/archive/2009/12/08/free-msdn-flash-ebook-of-the-best-13-technical-articles.aspx">original e-book post</a></p>
<p>Related posts:<ol>
<li><a href='http://www.leggetter.co.uk/2010/02/05/silverlight-uses-xcp-tmp-files-for-web-requests.html' rel='bookmark' title='Silverlight uses XCP tmp files for Web Requests'>Silverlight uses XCP tmp files for Web Requests</a></li>
<li><a href='http://www.leggetter.co.uk/2010/09/18/thoughts-on-an-seo-question-raised-in-the-social-media-white-noise-podcast.html' rel='bookmark' title='Thoughts on an SEO question raised in the Social Media White Noise podcast'>Thoughts on an SEO question raised in the Social Media White Noise podcast</a></li>
<li><a href='http://www.leggetter.co.uk/2009/08/05/book-review-juggle-rethink-work-reclaim-your-life.html' rel='bookmark' title='Book review: Juggle! Rethink work, reclaim your life'>Book review: Juggle! Rethink work, reclaim your life</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.leggetter.co.uk/2010/01/03/msdn-e-book-and-podcast.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
<enclosure url="http://ecn.channel9.msdn.com/o9/ch9/5/7/6/3/1/5/msdnflash016b.mp3" length="20402139" type="audio/mpeg" />
		</item>
		<item>
		<title>A Real Time Rich Internet Application (RTRIA) Example</title>
		<link>http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html</link>
		<comments>http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html#comments</comments>
		<pubDate>Tue, 03 Nov 2009 20:12:45 +0000</pubDate>
		<dc:creator>Phil Leggetter</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[real-time]]></category>
		<category><![CDATA[real-time data]]></category>
		<category><![CDATA[real-time web]]></category>
		<category><![CDATA[RTRIA]]></category>
		<category><![CDATA[silverlight]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://www.leggetter.co.uk/?p=423</guid>
		<description><![CDATA[<p>I&#8217;ve just had an article published in the latest <a href="http://msdn.microsoft.com/en-gb/aa570311.aspx">UK MSDN Flash newsletter</a> on How to consume real-time data in a Silverlight RIA. As part of writing up the article I developed a sample <a title="Real-Time Rich Internet Application" href="http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html">Real-Time Rich Internet Application (RTRIA)</a> that consumes real-time data from the <a href="http://apiwiki.twitter.com/Streaming-API-Documentation">Twitter real-time data [...]
Related posts:<ol>
<li><a href='http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html' rel='bookmark' title='Real-Time Rich Internet Applications (RTRIA)'>Real-Time Rich Internet Applications (RTRIA)</a></li>
<li><a href='http://www.leggetter.co.uk/2009/11/07/which-rich-internet-application-technology-will-dominate.html' rel='bookmark' title='Which Rich Internet Application Technology will dominate?'>Which Rich Internet Application Technology will dominate?</a></li>
<li><a href='http://www.leggetter.co.uk/2011/07/05/the-easiest-way-to-add-real-time-functionality-to-an-asp-net-e-commerce-application.html' rel='bookmark' title='The easiest way to add real-time functionality to an ASP.NET e-commerce application'>The easiest way to add real-time functionality to an ASP.NET e-commerce application</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just had an article published in the latest <a  href="http://msdn.microsoft.com/en-gb/aa570311.aspx">UK MSDN Flash newsletter</a> on <strong>How to consume real-time data in a Silverlight RIA</strong>. As part of writing up the article I developed a sample <a  title="Real-Time Rich Internet Application" href="http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html">Real-Time Rich Internet Application (RTRIA)</a> that consumes real-time data from the <a  href="http://apiwiki.twitter.com/Streaming-API-Documentation">Twitter real-time data feed</a>. I also put together my first ever <a  href="http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html#screencast">screencast</a>. So, you can start by <a  href="http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html#code">getting hold of the code</a> or <a  href="http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html#screencast">watching the screencast</a>.</p>
<p><a name="code"></a></p>
<h2>The Code</h2>
<p>First, and this is <strong>Important</strong>:</p>
<div class="important">To get the sample application to stream real-time data from the Twitter real-time feed you will need to <a href="http://www.leggetter.co.uk/2009/10/30/using-fiddler-to-trick-silverlight-into-allowing-a-crossdomain-web-request.html">use Fiddler to trick Silverlight into allowing a crossdomain Web Request</a>.</div>
<p>Now that you are aware of that, you will also need the Silverlight development environment. You can get everything you need via the <a  href="http://silverlight.net/getstarted/">Silverlight Getting Started page</a>.</p>
<p>You&#8217;ve now got everything you need to run the <em>RTRIA</em> example. To run the sample application you should set the <em>MSDNFlashRTRIAExample.Web</em> project as the startup project and the <em>MSDNFlashRTRIAExampleTestPage.html</em> page as the startup page.</p>
<div id="attachment_488" class="wp-caption alignnone" style="width: 345px"><img class="size-full wp-image-488" title="Setting up the solution to run the application" src="http://www.leggetter.co.uk/wp-content/uploads/2009/11/SetupForRunning.png" alt="Setting up the solution to run the application" width="335" height="264" /><p class="wp-caption-text">Setting up the solution to run the application</p></div>
<p>If you&#8217;d like to find out a bit more about the code then read on. If you&#8217;d rather jump straight into the code you can download it from the <a  href="http://code.google.com/p/tweetstreamer/">TweetStreamer Google Code project</a>.<br />
<span id="more-423"></span></p>
<h3>The streaming connection</h3>
<p>The following extracts of code may be slightly modified but that has been done to be able to explain what the code does in general a bit better.</p>
<p>The following extract is used to establish a connection to the Twitter real-time data stream using a <a  href="http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest(VS.95).aspx">HttpWebRequest</a>. The important thing to note is the use of <code>request.AllowReadStreamBuffering = false;</code> which is required since we are requesting a streaming feed. Without setting the <a  href="http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.allowreadstreambuffering(VS.95).aspx">AllowReadStreamBuffering</a> property to <code>false</code> the <code>ConnectionResponseCallback</code> callback will not be invoked because the response will be continuously buffering.</p>
<p>Since the Twitter real-time data stream requires authentication, and we can&#8217;t set <a  href="http://msdn.microsoft.com/en-us/library/system.net.webrequest.credentials(VS.95).aspx">Credentials</a> on the <code>HttpWebRequest</code> in Silverlight, the browser will prompt the user for a username and password.</p>
<pre class="brush: csharp; title: ; notranslate">
private const string SPRITZER_URL = &quot;http://stream.twitter.com/1/statuses/sample.json&quot;;

/// &lt;summary&gt;
/// Starts the connection to the Twitter real-time data stream.
/// &lt;/summary&gt;
public void Connect()
{
    this.InternalConnectionStatus = ConnectionStatus.Connecting;

    try
    {
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(SPRITZER_URL));
        request.AllowReadStreamBuffering = false;
        request.BeginGetResponse(ConnectionResponseCallback, request);
    }
    catch (Exception ex)
    {
        Debug.WriteLine(ex);
        this.InternalConnectionStatus = ConnectionStatus.Disconnected;
    }
}
</pre>
<p>Within the callback method we ensure that we are connected and then call the <code>ReadResponseStream</code> method which will not return until we call <code>Disconnect()</code>.</p>
<pre class="brush: csharp; title: ; notranslate">
/// &lt;summary&gt;
/// Called when the initial connection has been established.
/// &lt;/summary&gt;
private void ConnectionResponseCallback(IAsyncResult asynchronousResult)
{
    try
    {
        HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;
        using (HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asynchronousResult))
        {
            if (response.StatusCode == HttpStatusCode.OK)
            {
                this.InternalConnectionStatus = ConnectionStatus.Connected;

                this.ReadResponseStream(request, response);

                if (this.InternalConnectionStatus != ConnectionStatus.Disconnecting)
                {
                    // unexpected status
                    Debug.WriteLine(&quot;unexpected connection status: &quot; + this.InternalConnectionStatus);
                }
            }
            else
            {
                Debug.WriteLine(&quot;unexpected status code: &quot; + response.StatusCode);
            }
        }

        this.InternalConnectionStatus = ConnectionStatus.Disconnected;
    }
    catch (Exception ex)
    {
        Debug.WriteLine(ex);
    }
}
</pre>
<p>In the <code>ReadResponseStream</code> method we continually read the stream until we are interrupted by the user setting the connection status to a value other than <code>ConnectionStatus.Connected</code>, by calling the <code>Disconnect()</code> method, or an exception is thrown whilst reading from the <code>stream</code>. For each read from the stream we parse the data to get the tweets from the real-time data feed in <a  href="http://json.org/">JSON</a> format.</p>
<pre class="brush: csharp; title: ; notranslate">
/// &lt;summary&gt;
/// Reads the information received from the Twitter real-time data stream.
/// &lt;/summary&gt;
private void ReadResponseStream(HttpWebRequest request, HttpWebResponse response)
{
    byte[] buffer = new byte[65536];
    using (Stream stream = response.GetResponseStream())
    {
        while (this.InternalConnectionStatus == ConnectionStatus.Connected)
        {
            int read = stream.Read(buffer, 0, buffer.Length);
            UTF8Encoding encoding = new UTF8Encoding();
            string data = encoding.GetString(buffer, 0, read);
            ParseResponseChunk(data);
        }

        // need to call request.Abort or the the thread will block at the end of
        // the using block.
        request.Abort();
    }
}
</pre>
<p>The <code>ParseResponseChunk</code> checks the data it&#8217;s passed and ensures that the data contains at least one full status message (tweet). I&#8217;ll not go into the details of that here since it&#8217;s just a matter of string parsing.</p>
<p><small>I chose to use the JSON format simply because the content passed over the wire is smaller than the XML feed. This should mean that the application has to do less work to read all the data. What we really should also do is benchmark the deserialisation of JSON against the deserialisation of XML to see which performs best within a Silverlight application.<br />
</small></p>
<h3>Deserialising the JSON</h3>
<p>The following JavaScript JSON snipped shows an example of a single Tweet that we get back from the Twitter real-time data feed.</p>
<pre class="brush: jscript; title: ; notranslate">
{
    &quot;in_reply_to_status_id&quot;:9999999,
    &quot;in_reply_to_user_id&quot;:00000000,
    &quot;favorited&quot;:false,
    &quot;in_reply_to_screen_name&quot;:&quot;leggetter&quot;,
    &quot;text&quot;:&quot;@leggetter Wow! A Real-Time Rich Internet Application (RTRIA)&quot;,
    &quot;id&quot;:2820354600,
    &quot;created_at&quot;:&quot;Fri Nov 4 09:39:33 +0000 2009&quot;,
    &quot;truncated&quot;:false,
    &quot;source&quot;:&quot;&lt;a href=\&quot;http:\/\/tweetdeck.com\/\&quot;&gt;TweetDeck&lt;\/a&gt;&quot;
}
</pre>
<p>The JSON can be deserialised as an instance of a C# class using the <a  href="http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractattribute(VS.95).aspx">DataContract</a> attribute on the class and the <a  href="http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datamemberattribute(VS.95).aspx">DataMember</a> attributes on properties.</p>
<pre class="brush: csharp; title: ; notranslate">
using System;
using System.Runtime.Serialization.Json;
using System.Runtime.Serialization;
using System.ComponentModel;

namespace TweetStreamer
{
    [DataContract]
    public class StatusMessage : IStatusMessage, INotifyPropertyChanged
    {
        [DataMember(Name = &quot;text&quot;)]
        public string Text {get;set}
    }
}
</pre>
<p>A single Tweet, or in TweetStreamer a <code>StatusMessage</code>, can be deserialised using an instance of the <a  href="http://msdn.microsoft.com/en-us/library/system.runtime.serialization.json.datacontractjsonserializer(VS.95).aspx">DataContractJsonSerializer</a>.</p>
<pre class="brush: csharp; title: ; notranslate">
/// &lt;summary&gt;
/// Creates a single message from json string.
/// &lt;/summary&gt;
/// &lt;param name=&quot;messageData&quot;&gt;The message data.&lt;/param&gt;
/// &lt;returns&gt;&lt;/returns&gt;
private static IStatusMessage CreateMessageFromJsonString(string messageData)
{
    Debug.WriteLine(String.Format(&quot;Creating StatusMessage for: {0}&quot;, messageData));

    IStatusMessage message = null;

    using (MemoryStream stream = new MemoryStream(UTF8Encoding.UTF8.GetBytes(messageData)))
    {
        DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(StatusMessage));
        message = ser.ReadObject(stream) as StatusMessage;
    }

    if (string.IsNullOrEmpty(message.Id))
    {
        message = null;
        Debug.WriteLine(&quot;message had no ID. Assuming to be a delete message so nulling message object&quot;);
    }

    return message;
}
</pre>
<h3>Binding the data to the grid</h3>
<p>To bind the data to a DataGrid the grid needs to be defined in XAML. In addition we can specify the properties on the <code>StatusMessage</code> that we want to bind to columns. In the XAML below we are binding the <code>CreatedAtString</code> property to a Time column, a <code>User.ScreenName</code> to a User column, and a <code>Text</code> property to a Message column. Notice the cool binding of <code>User.ScreenName</code>. The <code>StatusMessage.User</code> property returns an instance of another class and we are actually binding to a property on the returned class.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;data:DataGrid Grid.Row=&quot;0&quot; x:Name=&quot;Tweets&quot; AutoGenerateColumns=&quot;False&quot;&gt;
    &lt;data:DataGrid.Columns&gt;
        &lt;data:DataGridTextColumn Header=&quot;Time&quot;
            Binding=&quot;{Binding CreatedAtString}&quot; /&gt;
        &lt;data:DataGridTextColumn Header=&quot;User&quot;
            Binding=&quot;{Binding User.ScreenName}&quot; /&gt;
        &lt;data:DataGridTextColumn Header=&quot;Message&quot;
            Binding=&quot;{Binding Text}&quot; /&gt;
    &lt;/data:DataGrid.Columns&gt;
&lt;/data:DataGrid&gt;
</pre>
<p>Next, the code to set up the binding and registering for <code>StatusMessage</code> updates using the <code> StatusMessageReceived</code> event. As you many have noticed, the <code>StatusMessage</code> object implements the <a  href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged(VS.95).aspx">INotifyPropertyChanged</a> interface. This was used so that we could add each <code>StatusMessage</code> to an <a  href="http://msdn.microsoft.com/en-us/library/ms668604(VS.95).aspx">ObservableCollection&lt;T&gt;</a> and then bind it to a <a  href="http://msdn.microsoft.com/en-us/library/system.windows.controls.datagrid(VS.95).aspx">DataGrid</a> to display the Tweets in real-time.</p>
<pre class="brush: csharp; title: ; notranslate">
Connection _twitterConnection;
ObservableCollection&lt;IStatusMessage&gt; _messages = new ObservableCollection&lt;IStatusMessage&gt;();
public MainPage()
{
    InitializeComponent();

    Tweets.ItemsSource = _messages;

    _twitterConnection = new Connection();
    _twitterConnection.StatusMessageReceived += new Connection.OnStatusMessageReceivedEventHandler
        (twitterConnection_StatusMessageReceived);
    _twitterConnection.Connect();
}
</pre>
<p>Finally, whenever we get a <code>StatusMessageReceived</code> callback we need to add the new <code>StatusMessage</code> to the <code>ObservableCollection<T></code> collection. <em>This has to be done on the UI thread and via the <code>Tweets.ItemsSource</code> property or the UI will not update.</em></p>
<pre class="brush: csharp; title: ; notranslate">
/// &lt;summary&gt;
/// Status message received event handler.
/// &lt;/summary&gt;
/// &lt;param name=&quot;sender&quot;&gt;&lt;/param&gt;
/// &lt;param name=&quot;args&quot;&gt;&lt;/param&gt;
void twitterConnection_StatusMessageReceived(object sender, IStatusMessageReceivedEventArgs args)
{
    Dispatcher.BeginInvoke(() =&gt;
        AddMessage(args.Message)
    );
}

/// &lt;summary&gt;
/// Adds a message to the observable message list which updates the UI.
/// &lt;/summary&gt;
/// &lt;param name=&quot;message&quot;&gt;&lt;/param&gt;
void AddMessage(IStatusMessage message)
{
    ObservableCollection&lt;IStatusMessage&gt; messageList = ((ObservableCollection&lt;IStatusMessage&gt;)Tweets.ItemsSource);
    messageList.Insert(0, message);
}
</pre>
<p>Hopefully this will have helped you understand how the Twitter real-time data stream is consumed and an example of how you can use it within a <strong>Real-Time Rich Internet Application</strong>. Now, why now <a  href="http://code.google.com/p/tweetstreamer/">download the TweetStreamer library and example application</a> and have a play.</p>
<div class="information"><strong>Limitations</strong>: Although I&#8217;ve seen the sample application perform reasonably well I&#8217;ve also seen it perform quite poorly. How well it performs will depend on the machine running the application and the frequency of the updates from the real-time Twitter stream. In later posts I&#8217;ll provide information on how to improve performance by making changes to the client code and I&#8217;ll also go into what can be done on the server.</div>
<h3>Download</h3>
<p>You can download the source from the <a  href="http://code.google.com/p/tweetstreamer/">TweetStreamer Google Code project</a>.<br />
<a name="screencast"></a></p>
<h2>Screencast</h2>
<p>This screencast was supposed to be short but ended up being just shy of 10 minutes. In it I provide some technical detail of how I built the application, show the basics of how Fiddler is used to give access to the Twitter real-time data stream, and give a demo of the application.<br />
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="625" height="505" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/5T_jiZCzg4U&amp;hl=en&amp;fs=1&amp;rel=0&amp;hd=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="625" height="505" src="http://www.youtube.com/v/5T_jiZCzg4U&amp;hl=en&amp;fs=1&amp;rel=0&amp;hd=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>Related posts:<ol>
<li><a href='http://www.leggetter.co.uk/2009/10/29/real-time-rich-internet-applications-rtria.html' rel='bookmark' title='Real-Time Rich Internet Applications (RTRIA)'>Real-Time Rich Internet Applications (RTRIA)</a></li>
<li><a href='http://www.leggetter.co.uk/2009/11/07/which-rich-internet-application-technology-will-dominate.html' rel='bookmark' title='Which Rich Internet Application Technology will dominate?'>Which Rich Internet Application Technology will dominate?</a></li>
<li><a href='http://www.leggetter.co.uk/2011/07/05/the-easiest-way-to-add-real-time-functionality-to-an-asp-net-e-commerce-application.html' rel='bookmark' title='The easiest way to add real-time functionality to an ASP.NET e-commerce application'>The easiest way to add real-time functionality to an ASP.NET e-commerce application</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.leggetter.co.uk/2009/11/03/a-real-time-rich-internet-application-rtria-example.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Database Caching 25/53 queries in 0.033 seconds using disk: basic

Served from: www.leggetter.co.uk @ 2012-02-04 20:15:17 -->
