Disclaimer: What follows are my personal impressions from investigating the community technology preview version of the Live Framwork (LiveFX). It is not meant to be an official description of the project from Microsoft, you can find that here.

At Microsoft's recent Professional Developer Conference, a new set of Web services called Live Framework (aka LiveFX) was unveiled. As I've spent the past year working on platforms for user experiences in Windows Live, I actually haven't been keeping up to date with what's going on in developer API land when it comes to programming against our services. So I decided to check out the Live Framework website and find out exactly what was announced.

What is it?

Although the main website is somewhat light on details, I eventually gleaned enough information from the Live Framework SDK documentation on MSDN to conclude that LiveFX consists of the following pieces

  1. A Resource Model: A set of RESTful APIs for interacting with Live Mesh and Windows Live data.
  2. Libraries: A set of libraries for the .NET Framework, Silverlight and Javascript for accessing the REST APIs.
  3. The Live Operating Environment: A local web server that implements #1 above so it can be programmed against using #2 above.

The Scary Architecture Diagram

This diagram tries to capture all the ideas in LiveFX in a single image. I found it somewhat overwhelming and after learning more about LiveFX I consider it to be a rather poor way of conveying across its key concepts.  It doesn't help that this diagram is somewhat aspirational given that some key pieces of the diagram are missing from the current technology preview. 

The Resource Model

Live Mesh and Windows Live data is exposed by LiveFX as a set of resources identified by URIs which can be interacted with via the Atom Publishing Protocol (RFC 5023). Relationships between resources are exposed as hyperlinks between resources. The hierarchical data model currently exposed in the CTP is shown in the diagram below taken from the MSDN documentation.

It should be noted that although AtomPub is the primary protocol for interacting with resources in LiveFX, multiple serialization formats can be used to retrieve data from the service including Atom, RSS, Plain Old XML (POX), JSON or even binary XML.

Since LiveFX is a fully compliant implementation of the Atom Publishing Protocol, one can browse to the service document of a user's Mesh or other top level resource and traverse links to various Atom collections and feeds in the hierarchy. Below is a screenshot of the LiveFX resource browser showing the service document for a user's Mesh with the links to various child collections exposed as hyperlinks.

Besides supporting multiple serialization formats, there are a number of other features of LiveFX that separate it from a vanilla implementation of the Atom Publishing Protocol.

  • Synchronization via FeedSync: Mesh resources in LiveFX can be synchronized using FeedSync (formerly Simple Sharing Extensions). FeedSync is a family of extensions to RSS and Atom that enables bidirectional synchronization of XML feeds and the resources they reference. However synchronization in LiveFX is based on a client/server model instead of a peer-to-peer model which means that instead of the server subscribing to changes from the client and vice versa, clients subscribe to changes from the server and then inform the server when they make a change. More information about how LiveFX implements FeedSync can be found here.

  • Query Model and Linq to REST: LiveFX supports the same URI query parameters for paging, sorting, filtering and inline expansion of linked resources as other Microsoft cloud-based data APIs including ADO.NET Data Services (formerly Astoria), SQL Server Data Services and Windows Azure Storage services. One of the benefits of this consistency is that the ADO.NET client libraries can be used to perform Linq queries over the LiveFX data types using a technology that has been colloquially described as Linq to REST. For example, the following C# Linq query actually executes HTTP GET requests using the $filter parameter under the covers.

    MeshObject GetMeshObjectByTitle(string title)
           {
               MeshObject meshObject = (from mo in mesh.CreateQuery<MeshObject>()
                                        where mo.Resource.Title == title
                                        select mo).FirstOrDefault<MeshObject>();
    
               return meshObject;
           }

    The HTTP request this makes over the wire is

    GET https://user-ctp.windows.net/V0.1/Mesh/MeshObjects/{meshObjectID}/DataFeeds/?$filter=(Title eq ‘WhateverWasPassedIn’)
  • Batch Requests via Resource Scripts: LiveFX supports batching using a construct known as resource scripts. Using resource scripts a developer can submit a single request which contains multiple create, retrieve, update and delete operations at once. A resource script consists of a control flow statement which can contain one or more control flow statements, web operation statements, synchronization statements, data flow constructs and data flow statements.  You can find out more about resource scripts by reading the document About Live Framework Resource Scripts on the LiveFX developer site.

  • Resource Introspection via OPTIONS: One problem that commonly occurs in REST APIs is determining which operations a resource supports. Some protocols like OpenSocial specify a mechanism where HTTP responses should indicate which parameters are not supported. The problem with this approach is that the client has to first make an HTTP request then have it fail before determining if the feature is supported. LiveFX supports the HTTP OPTIONS verb on every resource. By performing the following HTTP request

    OPTIONS https:// user-ctp.windows.net/V0.1/{UserID}/Mesh/MeshObjects/{meshObjectID}

    a client can retrieve an introspection metadata document which describes what query parameters and serialization formats the resource supports. The $metadata query parameter can also be used to retrieve the introspection metadata document. This enables clients using libraries that don't support making HTTP OPTIONS requests to also be able to retrieve introspection metadata.

  • Support for Portable Contacts: By specifying the parameter $type=portable when requesting contact data, the results will be returned in the Portable Contacts schema format as either JSON or Plain Old XML. 

The Libraries

Like most major Web vendors who have exposed REST APIs, Microsoft has provided client libraries to make interacting with the LiveFX service more natural for developers who aren't comfortable programming directly against HTTP. The following client libraries are provided

  • A generic AtomPub client library for the .NET Framework. Learn more about programming with it here.
  • A .NET Framework library which provides a high-level object model for interacting with the LiveFX service. More details here.
  • A Javascript library which provides a high-level object model for interacting with the LiveFX service. Programming samples can be found here.

The Live Operating Environment

The Live Operating Environment refers to two things. The first is the Web platform upon which the LiveFX REST APIs are implemented. The second is a  local cache which runs on your PC or other device which exposes the same REST interface as the LiveFX Web service. This is somewhat similar to Google Gears except that the database is accessed RESTfully instead of via a SQL API.

The intent of the local version of the Live Operating Environment is to enable developers to be able to build apps that target the desktop or the Web without having to change their programming model. All that needs to be altered is changing the base URI from https://user-ctp.windows.net to http://localhost:2048 when accessing LiveFX resources. Everything else works exactly the same.

The Bottom Line

As the title of this blog post states there is a lot of similarity in concept between LiveFX and Google's Data APIs (GData). Like GData, LiveFX provides a consistent set of AtomPub based APIs for accessing resources from a particular vendor's online services along with a set of client libraries that wrap these RESTful APIs. And just like GData, there are Microsoft-specific extensions to the Atom syndication format and custom query parameters for sorting, filtering and paging.  LiveFX also supports batching like GData, however from my perspective adding batching to a Web service seems like an attempt to reinvent distributed transactions. This is a bad idea given the flaws of distributed transactions that are well discussed in Pat Helland's excellent paper Life beyond Distributed Transactions: An Apostate's Opinion

A number of LiveFX's additional features such as synchronization and resource introspection which have no analog in GData are fairly interesting and I wouldn't be surprised to see these ideas get further traction in the industry. On the flip side, the client-side Live Operating Environment is a technology whose benefits elude me. I admit it is kind of cool but I can't see its utility.

Note Now Playing: John Legend - Green Light (feat. Andre 3000) Note


 

Monday, 17 November 2008 07:16:58 (GMT Standard Time, UTC+00:00)
I am most interested in the future plans for the client-side Live Operating Environment. This sounds like there is going to be an http server on client devices. I would like to be able to host web applications on my mobile phone that operated independently of having internet access and as agents when connectivity was available. I don't know how much syncing functionality I would need for such an environment but I do like the idea of a single application model. Do the JavaScript client libraries provide all of the same functionality as the .Net libraries provide?
scott
Monday, 17 November 2008 07:27:30 (GMT Standard Time, UTC+00:00)
Hey Scott, I'm the tech product manager of Live Services and I'd love to connect you with the right guys to riff about this.

Pls ping me on alogan at... microsoft.com or @anguslogan

thx
Monday, 17 November 2008 08:57:23 (GMT Standard Time, UTC+00:00)
Hey Scott - re the library parity for JS/.NET -- these should be be on parity or very close (i need to double check on some of the eventing/notification). I'll ping back to this thread or hit me on email.

thx
Monday, 17 November 2008 11:19:36 (GMT Standard Time, UTC+00:00)
Scott - I checked on the JavaScript API and the answer is -- yes, parity is the target, however the JS libraries targets Mesh-Enabled Web Applications so to that extent, it covers functionality that fits within those apps.

thx
Monday, 17 November 2008 19:31:30 (GMT Standard Time, UTC+00:00)
My God. Somewhere, Edward Tufte is staring at that architecture diagram and weeping.
Monday, 17 November 2008 19:41:56 (GMT Standard Time, UTC+00:00)
Do you know if the base AtomPub libraries are usable outside the Live environment? For example, could I use it to build my own AtomPub server as part of a blog engine?
shawn
Tuesday, 18 November 2008 08:29:46 (GMT Standard Time, UTC+00:00)
I made the same GData connection as you... The About Live Framework Resource Scripts PDF you reference actually has a hyperlink to GData's batch API documentation page, so Microsoft made it similar intentionally. I'm curious to see if the Microsoft APIs can be used with GData and vice versa.

The benefit of the client-side LOE is most obvious when you combine it with the LiveFX app model where your app can either run in the cloud "live desktop" or offline on the client without any code changes.

You may also be interested in the ability to host Flash as a Mesh app, getting similar benefits as Adobe AIR.
Tuesday, 18 November 2008 08:56:30 (GMT Standard Time, UTC+00:00)
Jason - we spent a ton of time geting the diagram to look nice :)
Tuesday, 18 November 2008 08:57:30 (GMT Standard Time, UTC+00:00)
Dare - re the purpose of the local Live Operating Environment - see this post by Danny Thorpe
Thursday, 20 November 2008 11:35:41 (GMT Standard Time, UTC+00:00)
Returning a body with OPTIONS is fine and has be done before (I think RFC 3253 was the first instance of that).

That being said, it's problematic to expect the server to always return the same kind of information -- it makes it very hard for a resource to support multiple protocols that all want a body in the OPTIONS response, but of a different kind.

IMHO the right way to do that is to indicate in the OPTIONS *request* what kind of response body format is expected. At least that's what RFC 3253 does (using the request body).
Julian Reschke
Comments are closed.