An Operating System for Your Personal Cloud


src="http://farm4.staticflickr.com/3187/3000614098_8e8924a8d3_m.jpg"
border="0" hspace="3" vspace="0"
align="right" width="150px" title="Lenticular Clouds Over Timpanogos" alt="Lenticular Clouds Over Timpanogos" />

Everyone has a cloud strategy these days. Of course, when you hear about clouds, you hear questions like “Are we talking about IaaS, PaaS, or SaaS?” This assumes an enterprise-centric view of clouds that is belied by what Robert Scoble calls the game of games. Facebook, Google, and Apple are most selling clouds in various guises and see their cloud strategy as a key to their future.

The problems with these “personal clouds” is that they have no operating system. An operating system is what makes your personal computer personal. Without an OS, it would be a special purpose appliance that does specific things (like run an office suite) but not others (like play a game). There are certainly those who wish that was the norm, but for now, at least, we have general purpose computers that run a variety of applications and can be configured according to the dictates and wishes of their owners.

[An aside for those of you getting ready to comment: yes Facebook allows apps and is an app platform, but they are ancillary to the experience, not core. The core experience is still very much a Facebook-determined thing.]

The user-focused clouds we see today are special purpose. You can’t customize them much or make them do something their builders didn’t envision in the selection of applications that they offer.

In contrast a personal event network is like an OS for your personal cloud. You can install apps to customize it for your purpose, it can store and manage your personal data, and it provides generalized services through APIs that any app can take advantage of.

Tags:

krl


kynetx


event+network


personal+cloud

Place-Based Networks


src="http://farm5.staticflickr.com/4051/4388225096_1585bf767c_m.jpg"
border="0" hspace="3" vspace="0"
align="right" width="150px" title="In the Classroom" alt="In the Classroom" />

Here’s a thought-provoking piece on place-based networks from Gideon Rosenblatt.

Imagine if the Internet worked the way the real world does – and that physical places still helped build connection and community.
That’s the idea behind Place-Based Networks; it’s mobile, social technology to help you connect with people based on your shared interest in a place.

I imagine that our personal event networks could help with that. If your personal event network knows where you are and what venues you frequent, it can automate things like tagging in your communications, negotiating meet-ups, and so on.

Tags:

place


geotagging


personal+events

Podcatchers for Smartphones


src="http://farm8.staticflickr.com/7159/6769089287_6d65e67230_m.jpg"
border="0" hspace="3" vspace="0"
align="right" width="150px" title="IT Conversations Logo" alt="IT Conversations Logo" />

As you might guess, given that I’m Executive Producer of IT Conversations, I like listening to podcasts. I’m also an iPhone user. Not to put too fine a point on it: iTunes sucks rocks for listening to podcasts. The problem is mostly that iTunes has a crappy interface for subscribing to and managing podcasts. It also downloads only one episode per day, with no way to change the defaults. Moreover it will stop downloading podcasts that you haven’t listened to for a while and you have to remember to go in an start it up. I started feeling like I had to “take care of iTunes” like it was a recalcitrant pet or something.

For some reason, it never really occurred to me to download an app for listening to podcasts, although I’ve downloaded several single purpose ones (like the This American Life app). Then Paul Figgiani introduced me to Downcast. I’m in love. I no longer have to fight iTunes and all my favorites are right there waiting for me to listen to them when I go for a walk or drive to work. The interface is good, with plenty of controls for skipping forward and back or adjusting the playback speed. I also like the built-in “share” features although I wish they allowed me to customize the default text for the share.

Unfortunately, Downcast isn’t available on Android. I have an Android tablet (Galaxy Tab) that I’ve used Google Listen on. It’s a functional podcatcher, albeit a little bare-boned compared to Downcast: no speed or skipping controls and no built-in sharing.

So, go grab Downcast, plug in the IT Conversations feed URL and enjoy great tech talks from the longest running podcast on the planet…no matter where you’re at.

Tags:

itconversations


podcasting


rss


iphone


android

My Letter to Senator Hatch in Opposition to PIPA



The Honorable Orrin Hatch

104 Hart Office Building

Washington, DC 20510

Fax: 202-224-6331

Dear Senator Hatch,

I’m writing to express my opposition to the Protect IP Act (PIPA). I have a PhD in Computer Science, have taught Computer Science at BYU, started several high-tech businesses in Utah (one of which, iMall.com, sold to Excite@Home in 1999 for $450 million), was the CIO for the State of Utah under Gov. Michael Levitt, and am the Precinct Vice-Chair in Lindon 04.

I’m pleased with Sen Reid’s decision to postpone the vote and with your recent opposition to PIPA. However I’m still concerned that the thinking that led to PIPA will lead to other equally bad legislation in the future.

The problem with PIPA and similar legislation is that it looks at copying as a feature of digital goods that can be selectively disabled. In fact, everything I know about computer technology leads me to believe that copying will only get easier and easier as technology progresses. We will never again live in a time when copying things is as difficult as it is now. And this will be true regardless of the laws we pass because copying is fundamental to the nature of computers and digital goods.

Consequently, efforts to make copying more difficult by technical means (such as the DNS blocking provisions in PIPA and SOPA) hurt legitimate uses of technology while leaving those who would copy without permission plenty of ways to circumvent those measures. You cannot plug this hole by hobbling the Internet and also be a proponent of economic growth. Those positions are incompatible.

I believe that the answer lies in enforcing existing laws in the courts where the accused are afforded due process and in working with other nations to create legal regimes wherein the guilty can be tried and punished. There are no technical shortcuts that will solve this problem.

I’d be happy to discuss this matter in more detail. I look forward to seeing you at the convention.

Respectfully,

Phillip J. Windley, Ph.D.

Note: the paragraph about copying paraphrases Cory Doctorow’s argument in his talk The Coming War on General Purpose Computing. I recommend listening to it.

Tags:

politics


utah


internet


technology

The Live Web is Live!

My book, The Live Web: Building Event-Based Connections in the Cloud, has been released and is on Amazon. Having the book actually available is great, although slightly anti-climatic after the thrill of just being done last November. :)

The book is my look at the future. When Eric Schmidt talks about a personalized house or we contemplate how commerce or health care will change in a completely connected world, that’s the Live Web.

Buying the book: If you are going to order a copy from Amazon, do be a favor and order it on Friday, January 13th. I’m trying to get the book to move up the rankings–if only for a day.

Here’s an excerpt from the Introduction:

For many years, pundits have foreseen a world in which everything will be connected to the Internet. We’re getting there. We now have Wi-Fi–enabled refrigerators, thermostats, and bathroom scales. But what happens after things are online? Will they merely connect to the Internet or will they connect to each other?

Connecting everything we use–products and services–to each other is a powerful idea. An idea that is bigger than mobile and social. Mobile’s big because everyone is connected all the time. Social is big because we’re connected to each other. Connecting us to everything around us is the next step.

Connecting our things to each other and setting them to work on our behalf is transformative. Imagine a world in which your phone automatically mutes the ringer when you start watching a movie. Imagine a world in which your alarm clock sets itself based on your schedule and other information like the weather, the traffic, and your past behavior. Imagine a world in which the mundane parts of business travel or scheduling an appointment with a new doctor are automatically taken care of according to your preferences. That world is the Live Web.

The Live Web: Building Event-Based Connections in the Cloud is a book about specific concepts, architectures, and technologies you can use to build Live Web experiences. This book is not easy; it requires that you think about Web programming from a brand new perspective. That’s hard for any of us. I have no business asking that of you unless there is a big payoff. There is: I believe the ideas and techniques in this book will help you build brand new types of Web experiences unlike those you can create using traditional Web technologies or languages like PHP or Rails. Don’t let this intimidate you. While this book asks a lot, the ideas are familiar and their application is engaging and fun.

The premise of this book is simple, but profound: The Web of the future–the Live Web–will link our lives in ways we can hardly imagine..and you can start building that Web today. While the request-response programming model we’ve been using has led to incredible applications and services, we can do more with a new model that complements–rather than replaces–the thinking that has led us so far. That new model is based on events.

Whereas today’s Web sites are about users interacting with relatively static pools of data, the cloud is giving us a brand new kind of data: data that is flowing, moving, and real-time. Data that links sites and services together. The cloud is about way more than just APIs to data and services–as important as that is. At its best, the cloud creates real-time interactions enabled by streams of data. The problem is that this kind of data doesn’t look like a request. Consequently using the tried and tested tools we’ve used to build Web services won’t take us where we need to go. Event-based interactions are the perfect model for taming these rivers of dynamic data and creating applications that make the most effective use of them.

Event-based applications are more loosely coupled than those built using a request-response model. I cannot overstate the case for loose coupling. As we move to a world in which more and more applications must coordinate their actions on our behalf, there is simply no way that we can pre-plan and orchestrate all the required interactions between them. Using systems that are supportive of and are architected for loosely coupled applications will play an important role in enabling the cloud-based future we envision.

This may seem a little overwhelming, but I have a secret weapon to help you out: a new programming language. I know what you’re thinking, “Wait, I’ve got to think differently about the Web and learn a new language too!?!” But in fact, I think the language helps, rather than hurts.

Tools shape how we think and work. I learned long ago that the best way to think differently about a problem is to create a nomenclature that describes and illuminates the new domain. In this book, you’ll use a language called the Kinetic Rules Language (KRL) to channel your thinking for this new model. KRL will lead you into the world of event-based programming on the Web.

KRL is a rule-based language that is custom built for the domain of event-based applications that operate on real-time data in the cloud. KRL was designed from the ground up with events and the cloud in mind. KRL provides a number of familiar touch-points for users already accustomed to Web programming and JavaScript, but provides a framework for making the most of an evented Web. While KRL is open and runs on an open source rules engine, you can get started with it right away using a cloud-based service.

While the ideas and techniques in this book can be implemented in any language, there is significant value in using a purpose-built language to guide our thinking. Remember, the ultimate value you will gain from this book isn’t learning any specific programming language, but in forcing your thinking down a new road–one in which events, rather than requests, reign supreme.

I’m very pleased with how the book turned out and extremely excited about the ideas in it. I hope you’ll read it, comment on it, review it, and try the ideas out. Undoubtedly, the future will turn out different than I’ve envisioned it, but I think we have an obligation to try to influence the design that emerges. The Live Web is my best thinking about how to do that.

Update: Some people have asked about a Kindle edition. There is a Kindle edition coming, but I don’t know when it will be available.

Tags:

krl


live+web


kynetx


book

Foursquare and Personal Data in a Personal Event Network


src="http://farm7.staticflickr.com/6197/6117660537_47f8f6eded_m.jpg"
border="0" hspace="3" vspace="0"
align="right" width="150px" title="PUSH" alt="PUSH" />

Lately I’ve been exploring APIs that push data and the use of personal data. While we’re proponents of the Evented API specification, there are already a number of APIs that push data in some way. One of those is Foursquare.com. The Foursquare push API will call a URL anytime a user checks in. (Foursquare calls it the “real-time” API, but I’m coming to dislike that term as a description for this functionality.) They post data to a URL of your choosing. Turns out, with the Sky API accepts event signal URLs (ESLs) that meet the Evented API Specification and Foursquare can use properly formatted ESLs with their Push API. Consequently, Foursquare’s Push API works perfectly with KRL.

Once I’ve checked in and Foursquare has pushed the checkin data to an ESL being watched by a KRL application, it’s easy enough to store that data and then retrieve it from the same ruleset. KRL has identity built-in along with a concept of stateful variables that persist from invocation to invocation. These variables, called entity variables store data persistently on an entity-by-entity basis without any work on the developer’s part.

But I wanted something more–a personal data store. I wanted the ruleset processing the checkin to see the Foursquare checkin event and put the data somewhere where other rulesets could use it. A KRL module with an associated rule turns out to be a good way to do this. The rule responds to a pds:new_location_available event and stores that data away. Other rulesets can access to the data using a function provided as a module. This ruleset just looks like any other application in my personal even network, seeing relevant events and doing it’s job–but also functions as a KRL module for retrieving the data values.

The final result looks something like the diagram below.


src="http://farm8.staticflickr.com/7164/6644042891_fbac3fa6c7.jpg"
border="0" hspace="3" vspace="0"
align="center" width="420px" title="Foursquare and PDS" alt="Foursquare and PDS" />

(click to enlarge)

Whenever I checkin at Foursquare, a foursquare:checkin event is raised to my personal event network. One of the apps, I’ve installed, the Foursquare Processor ruleset, is listening for events of that domain and type. The Foursquare Processor manipulates the data that Foursquare has sent and raises a pds:new_location_available event. Another app I’ve installed, the Personal Data Manager ruleset, is listening for that event and merely stores the Foursquare data away in an entity variable.

Later, I visit a Web page, exampley.com in this case, and a rule in another app I’ve installed, the PDS Inspector ruleset, retrieves the latest Foursquare checkin information from my Personal Data Manager using a function, get_location(), and displays it.

You can see these apps installed in my personal event network in the following screenshot. The apps that make this work are the ones in the red rectangle.


src="http://farm8.staticflickr.com/7144/6644042435_439841a6f1.jpg"
border="0" hspace="3" vspace="0"
align="center" width="420px" title="My Personal Event Network" alt="My Personal Event Network" />

(click to enlarge)

“Wait a minute!” I can hear you saying. “That’s just the ‘Manage Apps’ page in your Kynetx browser extension!” Precisely. Installing an app in my Kynetx account is the same thing as installing it in my personal event network. My Kynetx account is showing me the apps that I’ve got installed in my personal event network and it’s where I control how they behave. If you have a Kynetx account, you already have a personal event network.

A few points to make:

  • None of these apps knows about the other ones. They are loosely coupled. None of them know what’s going to happen when they raise their respective events because an event isn’t a request. The behavior emerges from the particular suite of apps I have installed.
  • This behavior isn’t hard coded for me. These apps work generally across anyone’s personal event network. Because these are stored in entity variables, if you install these apps in your personal event network, then you’ll see your data, not mine. When you look at the code below, you won’t see any code that makes that happen. That’s because the personal event network infrastructure is handling all of the identity information below the ruleset level. KRL developers get multi-tenanted applications for free.
  • Personal data is being managed by a separate ruleset allowing for indirection in how the data is used. Storing the checkin and seeing the checkin are asynchronous processes. Only apps I’ve installed in my personal event network can see the personal data in the Personal Data Manager. To see the data, apps have to use the Personal Data Manager module and thus disclose their intent to use personal data. This is not a final answer to a personal data store since it doesn’t provide for explicit user permissioning, but it’s getting a lot closer.

This demonstration shows a personal event network responding to Foursquare checkin events and storing the information about the checkin in a personal data service using a manager application that is loosely coupled and privacy respecting. Pretty cool, huh?

The Gory Details

What follows are the gory details of how it all works. Keep reading if you’re into that sort of thing.

The Foursquare Real-Time API and KRL Events

Foursquare provides a method for creating an OAuth consumer. As part of that process, you’ll need to register your application, providing the Web site URL and a callback URL. After you register the application, you need to edit it to provide a push URL. This is where you put the Sky API ESL:


https://cs.kobj.net/sky/event/<token>/fakeeid/foursquare/checkin

The token identifies the personal event network that the event is sent to. It’s unique to the particular application raising the event. This creates a revokable, one-to-one connection between the Foursquare OAuth consumer and the personal event network. The token generator is still in beta; if you’d like to play with this, contact me and I’ll tell you how to get to it. Here’s what the Foursquare OAuth consumer page looks like when you’re done:


src="http://farm8.staticflickr.com/7029/6644069269_f02fef7e7f.jpg"
border="0" hspace="3" vspace="0"
align="center" width="420px" title="App configuration page at Foursquare" alt="App configuration page at Foursquare" />

(click to enlarge)

You have to use OAuth to tie a Foursquare account to this Foursquare consumer. I just did it manually (cutting and pasting URLs into my browser) so that my Foursquare account was tied to this consumer. We’re not quite using the Foursquare API the way they envisioned it. They think of a single OAuth consumer handling multiple accounts and thus a single push URL being used to push checkin data for every user who has authorized the OAuth consumer to see their acccount.

Instead, I’m tying the push URL (an ELS) to an OAuth consumer and then only tying a single user account to each OAuth consumer. This allows the Foursquare OAuth consumer to function as an endpoint for a single personal event network. The following diagram shows this difference.


src="http://farm8.staticflickr.com/7169/6644788653_11f8a0326b.jpg"
border="0" hspace="3" vspace="0"
align="center" width="420px" title="Foursquare" alt="Foursquare" />

(click to enlarge)

I’d like to see Foursquare allow a user to associate a push URL directly with their account to save the trouble of creating serperate OAuth consumers and going through the OAuth process, but this works fine for now. The consumer detail page (shown above) contains a button for testing the push URL. You can do this before you go through the OAuth process. The biggest problem I had with it is that it didn’t show the return value or response code and I was having a few problems debugging it, so that would have been helpful.

Once you’ve made these links, you have a Foursquare endpoint raising checkin events to your personal event network whenever you checkin with the Foursquare app on your smart phone:


src="http://farm8.staticflickr.com/7159/6644042693_43b5ca0eba.jpg"
border="0" hspace="3" vspace="0"
align="center" width="240px" title="Foursquare Checkin" alt="Foursquare Checkin" />

(click to enlarge)

The Foursquare Processor


src="http://farm8.staticflickr.com/7033/6644195175_85798427b7_m.jpg"
border="0" hspace="3" vspace="0"
align="right" width="125px" title="foursquare_logo-300x300" alt="foursquare_logo-300x300" />

The Foursquare processor is a KRL ruleset that is listening for foursquare:checkin events. The rule is selected when a foursquare:checkin event is raised. If you look cartefully at the event signal URL we gave to Foursquare that’s shown above, you’ll see that we’ve encoded that event domain (foursquare) and type (checkin) in the URL.

Here’s the rule:

rule fs_checkin {
  select when foursquare checkin
  pre {
    // decode the JSON to get the data structure
    checkin = event:attr("checkin").decode();          
  }
  noop();
  fired {
    raise pds event new_location_available with
       key = "foursquare" and
       value = 
         {"venue": checkin.pick("$..venue.name"),
          "city": checkin.pick("$..location.city"),
          "shout": checkin.pick("$..shout", true).head(),
          "createdAt": checkin.pick("$..createdAt")
         }
  }
}

I’m picking apart the JSON structure that Foursquare sends and just looking at four values: the venue name, the city, the shout, and the checkin time. There’s lots more data there, but this was sufficient for my purposes.

The rule’s sole result is to raise another event, pds:new_location_available. Any other ruleset in the personal event network might be listening for this event. Note that this rule isn’t controlling who will see the event or what they’re supposed to do with it if they do see it. This is an example of semantic encapsulation that aids the loose coupling of personal event network applications.

The Personal Data Manager


src="http://farm8.staticflickr.com/7167/6644195245_96d0fc70a3_m.jpg"
border="0" hspace="3" vspace="0"
align="right" width="125px" title="personal data manager" alt="personal data manager" />

The Personal Data Manager (PDM) ruleset is perhaps the most interesting of the three rulesets presented here because it’s functioning as a ruleset to process event and a module for retrieving data. The PDM ruleset has a rule that is listening for the pds:new_location_available event that the Foursquare Processor ruleset raises.

rule add_location_item {
  select when pds new_location_available
  noop();
  always {
    set ent:location{event:attr("key")} 
        event:attr("value");
    log "Saw " + event:attr("key") + " data";
    raise pds event new_location_item_added 
      with key = event:attr("key");
  }
}

This rule does three things when it sees a salient event:

  1. Stores the value of the event attribute named value in an entity variable named ent:location. Ent:location is a map and the key is taken from the event attribute named key.
  2. Writes a log message that it saw data with a given key.
  3. Raises a pds:new_location_item_added event.

The first is the primary result we want from this rule: the data gets stored in an entity variable. As I mentioned above, because this is an entity variable it will be persistently stored for the entity that owns the personal event network where this rule is running. In other words, the personal event network has a built-in method for storing personal data without the programmer ever having to worry about the identity and database issues involved in making it work.

The third result is interesting because it ensures that this rule is not a dead-end leaf on the event tree. In the case of this demonstration, there isn’t any ruleset listening for the pds:new_location_item_added event in my personal event network; but there could be. Next week I might install an app that needs to know when my location changes and it will see this event and do whatever it does. Ensuring that there are no dead-ends is a good practice that aids loose coupling.

In addition to having a rule that responds to events and stores data, the PDM ruleset is also a KRL module:

meta {
  name "Personal Data Manager"
  provides get_item, get_location
}

global { 
  get_location = function (k) {
    ent:location{k};
  };
}

The module provides two functions: get_item() (not shown) and get_location(). Get_location() simply accesses and returns the value stored with a given key, k, in the location entity variable, ent:location.

Note that modules form a closure over persistent variables used in the ruleset because of the static scoping or persistent variables in modules. That means that when a rule stores something in a persistent variable in a module and a provided function retrieves it, they’re talking about the same piece of data. This is the magic that allows a ruleset to act as a personal data manager.

The Personal Data Inspector


src="http://farm8.staticflickr.com/7144/6644195313_a7b92b876d_m.jpg"
border="0" hspace="3" vspace="0"
align="right" width="125px" title="pds inspect" alt="pds inspect" />

The Personal Data Inspector ruleset is simply a convinience for testing the system we’ve put in place and seeing that it all works. This app is a pretty standard KRL ruleset for modifying a Web page. The ruleset uses the PDM ruleset as a module so that it has access to the location data.

Here’s the code for the entire ruleset:

ruleset a16x138 {
  meta {
    name "PDS Inspector"
    use module a16x137 version "dev" alias pds
  }

  dispatch {
    domain "exampley.com"
  }
  
  rule show_location_data {
    select when pageview ".*"
    pre {
      fs_location = pds:get_location("foursquare");
      v = fs_location.pick("$..venue");
      c = fs_location.pick("$..city");
      s = fs_location.pick("$..shout");
      t = "Phil last seen at #{v} in #{c}";
      body = 
        (s.typeof()) eq "str" => t + ' saying "#{s}"'
                               | t;
    }
  notify("Where's Phil?", body) with sticky = true;
}

The operation of the ruleset is simple:

  • The ruleset uses the PDM ruleset (a16x137) aliasing it with the name pds.
  • The dispatch section declares exampley.com as a salient domain so that the Kynetx Browser Extension (KBX) knows to run this ruleset on that domain.
  • The rule uses the function pds:get_location() function from the PDM module with the key “foursquare” to get the data for the last checkin, picks it apart, and places a notification box on the Web page with the data about the last checkin.

With that, I see a notifcation box like this whenever I visit exampley.com:


src="http://farm8.staticflickr.com/7143/6644042783_24b5c8998e.jpg"
border="1" hspace="3" vspace="0"
align="center" width="420px" title="Foursquare data displayed on Exampley.com" alt="Foursquare data displayed on Exampley.com" />

(click to enlarge)

This notification is happening aynchronously from the checkin data being stored. The Foursquare Processor ruleset stores the data whenever I check in. The PDS Inspector ruleset shows the last checking location whenever I visit this particular Web page. The PDM rule is sitting between then providing data storage for the shared data that these two rulesets use.

Conclusion

This demonstration has shown three primary ideas:

  1. Foursquare can be configured as an endpoint for a personal event network.
  2. A KRL ruleset can function as a data manager for personal data within the personal event network.
  3. A personal event network can function as an entity-specific event bus, allowing loosely coupled, semantically isolated applications to function together on an owner’s behalf.

These ideas are each an important building block in creating the vision for personal event networks that function on behalf of their owners, protecting personal data and allowing applications to use shared personal data.

Tags:

personal+events


personal+data


foursquare


events


krl


kynetx

Notifications in Personal Event Networks


src=”http://farm5.staticflickr.com/4135/4868871700_90a4b44eea_m.jpg”
border=”0″ hspace=”3″ vspace=”0″
align=”right” width=”150px” title=”10 floppies” alt=”10 floppies” />

If you’re old enough to remember WordPerfect on DOS, it always came with a stack of disks for the printer drivers. That’s because DOS had no printer drivers. Every application had to handle the printer itself. Every program treated the printer differently and the results were uneven at best. WordPerfect and other programs succeeded where others failed partly on the strength of their printer drivers. When Windows came along, it included printer drivers. This was a big change; once the OS knew about your printer and how to work with it, any application could print without ever worrying about the printer or how it works. I suspect WordPerfect had a dozen or more people working on printer drivers back in the day. With Windows that burden went away. (Well, not really since WordPerfect couldn’t let go of DOS, but that’s a different story…the burden could have gone away).

In the same way, providing event APIs for common services and then supplying rulesets that handle those services make personal event networks more powerful and easier to use. Personal event networks unleash tremendous power for apps to cooperate to provide better and more flexible services for their owners and a great deal of leverage for programmers who don’t have to program all those services over and over.

A few weeks ago, I blogged about the new Sky API and what it means for KRL programmers. With Sky, KRL developers can raise events that any app a user has activated will see. In this post, I’ll discuss a generalized event API for notiications. This is going to be a long post, so hang on. I’ll break it up into sections that deal with specific parts of the post. You can probably stop reading after any section and have a good idea of why this matters to a certain level of specificity.

Notification Events

 

src=”http://farm5.staticflickr.com/4033/4660619662_43226d56f9_m.jpg”
border=”0″ hspace=”3″ vspace=”0″
align=”right” width=”150px” title=”Urgent News” alt=”Urgent News” />

The Notification Event API defines an event domain, notification and two event types, status and log. Today, I’m going to focus on status events.

A status event has several attributes:

  • application (optional) – name of the application/ruleset raising the notification event. If not application is given, the current ruleset ID is used.
  • subject (required) – subject (title) of the notification. Typically a subject is one line.
  • description (optional) – additional information beyond what is in the subject.
  • priority (optional) – Every notification has a priority. If not priority is given, the priority is 0. The priorities are:
    • -2 (Very low)
    • -1 (Moderate)
    • 0 (Normal)
    • +1 (High)
    • +2 (Emergency)
  • id (optional) – a unique identifier that the event raiser chooses.

Our purpose in defining the Notification Event API is to put a stake in the ground around how notifications messages will be handled in a personal event network. With such a standard, developers can write apps that manage the notifications for a user’s personal event network. Other developers can raise notification events knowing that if the user wants to see notifications, they will have activated an application that handles them. In effect, the Notification Event API is the printer interface for a personal event network.

This is the key point: with this development, KRL developers don’t ever have to build notifications into their apps or worry about meeting the user’s demands with regard to how they want to be notified. That’s someone else’s job. I anticipate that we’ll give everyone with a KBX a basic notification application that they can use and configure. If they don’t like that one, they can replace it with another one so long as it handles events as specified in the Notification Event API

For example, the basic notification app will likely make heavy use of email and SMS, but you could imagine someone building and selling an app that uses a service like Urban Airship to send notifications to a custom mobile application that manages them, allows for responses, and so on.

Events in the Personal Event Network

This wouldn’t work if every app needing to make a notification had to be configured so it knew the identifier of the app that the user wanted to handle notifications. That’s why Sky is so important.

I have a Simple Notification app and a Notification Testing app activated in my Kynetx account. The test app paints a form on a page and when the form is submitted turns the fields in the form into a notifiation:status event. Because the Simple Notification app is listening for notification:status events, it responds. Nothing links them except that I have them both activated in my account. If I delete the Simple Notification app and replace it with another that understands the Notification Event API, that new app will automatically start processing notifications for me. I can have more than one app listening for notification events. moreover, I can activate a dozen or a hundred apps that raise notification:status events and they will all be handled by whatever apps I’ve activated to listen for those particular events.

By defining the semantics of some common APIs like the one for notifications, we can start to build out flexible services on top of personal event networks. Users are in complete control of which apps they activate to handle those services. I suspect that most people will use the standard ones that we supply, but I also hope other developers see value in creating custom rulesets to handle common events.

This isn’t unlike drivers for an operating system or standard services in application server. I’d be hard pressed to overemphasize the importance of this fact. Personal event networks are real and work now.

If you’ve been following along for the last year, you might be scratching your head and thinking “wait a minute, I thought that the apps I activated in my Kynetx account were ‘browser apps’ and just affected my browsing experience!” Nope! Those apps are functioning on the personal event network you created when you signed up for a Kynetx account. It just happens that all of the ones you’ve activated to date, work in the browser. They don’t have to.

Processing Status Notifications

The simple notification ruleset has three rules to handle status notifications: one for notifications with priority 2, one for notifications with priority 0 or 1, and one for notifications with priority less than 0.

The meta section declares three libraries we’re going to use: prowl, sendgrid, and Google spreadsheets:

use module a16x83 alias prowl with
  apikey = keys:prowl_test("apikey") and
  providerkey = keys:prowl_test("providerkey") and
  application = "Kynetx Notification Manager"

use module a16x129 version "dev" alias sendgrid with
  api_user = keys:sendgrid("api_user") and
  api_key = keys:sendgrid("api_key") and
  application = "Kynetx Notification Manager"

use module a163x73 version "dev" alias spreadsheet with
  docskey = keys:docskey();

The ruleset processes event attributes, including setting defaults, in the global block so that they’re available for the various rules:

global {
  app = event:attr("application");
  subj = event:attr("subject") ||
     "Status Notification for #{app}";
  priority = event:attr("priority") || 0;
  description = event:attr("description") ||
     "A status notification with priority
      #{priority} was received from #{app}." ;
}

Low priority notifications (less than 0) are handled by the logonly rule. The logonly rule uses a Google spreadsheet module to merely save the notification in a “logging” spreadsheet to they can be viewed later:

rule low {
  select when notification status priority "^-[12]$"
  spreadsheet:submitrow() with
      values = [app, priority, subj, description]
}

The result of this rule firing is a logging line in a google spreadsheet that records the attributes of the notification:

Google notification
(click to enlarge)

Medium priority notifications (0 or 1) are handled by the routine rule. The routine rule uses a SendGrid module to send an email to the owner of the personal event network. Right now, I’m storing the email address in an entity variable and setting it in a configuration step, but eventually that kind of data ought to be routinely available to the personal event network without multiple configurations.

rule routine {
  select when notification status priority "^[01]$"
  sendgrid:send(name,
                ent:email_address,
                "#{app}: #{subj}",
                description);
}

The result of this rule fire is an email that looks like this:

Email notification

High priority notifications (2) are handled by the urgent rule. The urgent rule uses Prowl and a Prowl module to push notifications to the owner’s phone. SMS is more generally available and would be a better choice for widely used ruleset, but I was anxious to try out Prowl. (Kind of a poor man’s Urban Airship.)

rule urgent {
  select when notification status priority "^2$"
  prowl:notify(subj, description) with priority = priority;
}

The result of this rule firing is a push notification to my phone:

Prowl notification

The ruleset could be improved in a number of ways, including providing more configuration options for choosing what level of notifications get sent where and breaking out all five levels of notifications.

Using the Simple Notification App

As I said, any ruleset that the owner of the personal event network has activated can raise a notification:status event and the simple notification app will handle it according to the rules we just reviewed. To test it, I wrote a ruleset that places a form on a page and then raises notification:status events with the event attributes taken from the form. Here’s an example of the form:

Priority 2 form

Here’s the rule that handles the form submission:

rule respond_submit is active {
  select when web submit "#test_form"
  noop();
  always {
    raise notification event status with
      priority = event:attr("priority") and
      application =
        event:attr("application") || "Kynetx Test" and
      subject = event:attr("subject") || "No Subject" and
      description = event:attr("desc") and
      _api = "sky"
  }
}

The important part is the rule postlude (the always clause) where a notification:status event is raised with the appropriate attributes (taken from the form). Note that the raise statement does not specify the previous ruleset or any other for handling the event. That is determined automatically by the system based on what apps the owner of the personal event network has activate.

The only tricky part is the special attribute _api that tells the rules engine to use Sky API processing semantics when the event is raised. The current runtime still uses the Blue API and the rules engine tries to maintain consistency–if you start with Blue, it’s Blue all the way through…unless you force another API as I have here.

Conclusions

If you’re still with me, congratulations. This post has demonstrated the power of common services in a personal event network and shown how they can be implemented and leveraged. To summarize:

  • Sky means that any ruleset a personal event network owner activates will see relevant events from other rulesets that have been activated in the same network.
  • The Notification Event API defines a generalized service API for personal event networks. More will follow. If you have suggestions of other common services that ought to be standardized with an API, we’re listening.
  • There will be certain services, like notifications, that every almost personal event network has a ruleset to handle. They can be customized to match the purpose of the personal event network.

 

Tags:

krl


notifications


sky+api


kynetx

A Web of Things on the Internet of Things


src=”http://farm5.staticflickr.com/4052/4527076709_4856e45987_m.jpg”
border=”0″ hspace=”3″ vspace=”0″
align=”right” width=”150px” title=”[]” alt=”[]” />

This article by Marshall Kirkpatrick describes why the Internet of Things is real and happening right before our eyes. The Internet of Things is happening because more and more things are being connected to the ‘Net. This, of course, is inevitable as Moore’s Law incessantly drops the price of such connectivity. Marshall says “real-world devices not traditionally connected to the Internet that will be wired-up into a future Web of Things.”

I like the phrase “Web of Things” because “Internet of Things” has come to describe what is known as “M2M” or machine-to-machine connection. Web of Things conveys something different to me. Where M2M is about connecting things together for what ever reason, Web of Things implies a higher level of functionality and something that people will use.

M2M technologies are being used to create services that back up physical products. This is the idea I blogged about recently with products as avatars for a service. Many products are really just physical manifestations of the real product which is an evergreen service. Tivo is a good example. So are phones, Fitbit, and even my Ford truck.

Marshall uses the example of a traffic sign:

If you’ve ever driven past one of those big signs on a road that show you your own driving speed, you might have wondered who else was seeing that information. Originally, no one else was. A company called AllTraffic sold those signs to government agencies around the US as a hardware play. Stick it on the side of the road and show people how fast they are going – hopefully it will cause speeders to slow down.

About a year and a half ago, though, they connected those blinking signs to a web portal accessible by police headquarters and citizens, using Axeda’s connectivity technology. Now they sell access as a subscription and they’ve changed from being a hardware vendor into a software and service vendor.

From Google X? These Nine Products From the Future Are Real Right Now
Referenced Thu Dec 15 2011 10:14:03 GMT-0700 (MST)

We might view M2M interactions like this:

M2M relationships

A manufacturer, GE in this case, has created a network of all the devices they manufacturer of a particular type for purposes of managing those things. They might update the software in your dishwasher, gather operating statistics, and so on. Marshall talks about this:

[Bill] Zujewski [of Axeda] shared a story with me about a dishwasher manufacturer that made a mistake. The company didn’t program its rinse cycle to be long enough and was getting thousands of phone calls from customers complaining that the machines weren’t working well. The company sent a technician out to reset the rinse cycle timers – but future iterations of the machines saved all those costs by adding read/write cellular connections to the dishwasher computers that could be re-calibrated remotely.

Ovens, dishwashers, all kinds of appliances get shipped from the factory with certain assumptions. Add connectivity and they can be optimized, in the field, remotely.

From Google X? These Nine Products From the Future Are Real Right Now
Referenced Thu Dec 15 2011 10:22:18 GMT-0700 (MST)

But of course, once the dishwasher has connectivity, then all kinds of things are possible. Marshall continues:

[O]nce the computer is on board, you may as well start building apps that add value directly to the consumer as well.

Want to start the pre-heating cycle from your phone, while on your way home? Can’t remember if you turned your oven off or not? An application framework layer on those devices enables engagement with the devices themselves via mobile device.

“Because cellular connection capabilities for these devices are coming down from hundreds of dollars, sprinklers, garage doors, smoke detectors, all kinds of things are being experimented with as connected devices,” Zujewski says. “It wasn’t economic before because consumers wouldn’t pay for that connectivity, but if it was a couple cents a month, then they will. Right now, costs are around $50 per month to retrofit devices with connectivity, but if you can do it with a chip involved at the origina of design, it can be around $10 per month.”

If you can engineer connectivity right into the product from the start, the price drops dramatically. The sales cycle is long, though, because it takes years to bake connectivity into the core of a device.

From Google X? These Nine Products From the Future Are Real Right Now
Referenced Thu Dec 15 2011 10:24:42 GMT-0700 (MST)

How all this happens is of intense interest to me and my colleagues at Kynetx. I don’t just want apps on my phone that control my oven. Our view is bigger than that. We want things–what we call social products–cooperating on behalf of their owner. For this to work people need personal event networks–a private cloud–where their products and services can interact to get things done for them. I don’t merely want dashboards so I can turn on my oven from my iPhone or remotely check the temperature. I dream of my things working together with only modest intervention and interaction with me.

The following picture illustrates how I think personal event networks will interrelate to M2M networks that manufacturers are bound to put in place. This creates a Web of Things:

Web of Things

While the manufacturers still have their M2M connectivity so they can manage my things (presumably with my permission), each of the things I own is also part of my personal event network. My personal event network also has access to APIs for Web services and personal data. Applications running in my personal event network do the heavy lifting of scripting interactions for my things. Some of these might come from manufacturers; many come from third-party developers.

Giving me more apps on my phone and more things to manage doesn’t appeal to me. Giving companies more control over my life doesn’t appeal to me. But giving me a personal network that automates drudgery and enables things that I couldn’t do before does. That’s the promise of a personal event network and why I think everyone will want one.

Tags:

internet+of+things


kynetx


personal+events

APIs That Call You


src=”http://farm4.staticflickr.com/3051/2653055999_f022327941_m.jpg”
border=”0″ hspace=”3″ vspace=”0″
align=”right” width=”150px” title=”Telephone Pole” alt=”Telephone Pole” />

Ever since I heard Tibco’s CEO, Vivek Ranadiv say that a database is like a phone that doesn’t ring, I’ve used it as a way to describe why APIs should be two-way. Another metaphor we’ve used to describe this is by talking about “full-duplex” APIs, although there’s a little mismatch with that.

There are at least three different modes in which an API might send data:

  1. Continuous stream – some system need to be in near-constant contact with the other participants. For example, a chat system needs to be ready to send and receive information from the participants at almost any time. Another way to think of these kinds of API interactions is as persistent connections.
  2. Broadcast – some systems have data that they must distribute to many participants. A blog post being sent to multiple subscribers is an example of this.
  3. Evented – some systems need to push data to one or a few other systems when something happens (i.e. when there’s an event). Some APIs are for user (entity) accounts and the data being sent is related to a specific entity and destined for another system where that same user has an account. Some are merely point-to-point connections. The key idea is that there’s an event that needs to be seen by a few other systems.

The first and second scenarios have specifications that are widely known, if unequally used. Continuous stream applications can use Cometd or Web sockets. PubSubHubBub (PuSH) is commonly used in broadcast-style applications.

Twilio is probably the best example of an evented API. They’re using Webhooks, a good solution for this sort of thing. But many other point-to-point or entity-centry applications are using home grown solutions that tend to be used only by that one API. Take Fitbit, for example. I love my Fitbit, but their “subscription API” is “loosely modeled on PubSubHubbub (PuSH), with simplifications.” Don’t get me wrong–I’m glad they have one at all–but PuSH probably isn’t the best place to start for this application.

Sam Curren and I have proposed the Evented API specification for this sort of thing. Evented APIs are specializations of Webhooks. All APIs that follow the Evented API specification are Webhooks, but not all Webhooks are examples of evented APIs.

Evented APIs are not meant to be used as continuous streams or broadcast subscriptions. They are designed for one-to-one or one-to-a-few interactions. Let’s return to Fitbit. I’m a Fitbit user. I have an account. If I want to link my Fitbit account to some other online service where I also have an account, then an Evented API would be a perfect fit (bit).

There’s nothing “wrong” with how Fitbit’s doing it, but it’s not standard. This is an argument about standards, not about the “right way.” If we can all agree on a standard for point-to-point and entity-centric API interactions, we can start to create libraries for common programming languages and develop pools of expertise. Sam and I created the Evented API specification to solve this problem. Kynetx supports the Evented API, but the specification is independent and does not rely on any proprietary technology.

APIs that call you are relatively new and consequiently unfamiliar. Undersanding what type of subscription or push interaction you need to support will lead you to the best way to do it. We’ll be taking the Evented API specification to a standards body next year. We’d love to get your comments. We’d really love for you to start using it and give us feedback based on real-world experience.

Tags:

evented+api


kynetx


PuSH


cometd

Products as Avatars for a Service


src="http://farm3.staticflickr.com/2209/5817707171_7aeba8e0c7_m.jpg"
border="0" hspace="3" vspace="0"
align="right" width="150px" title="Avatar" alt="Avatar" />

I’ve read three interesting articles recently that describe an idea I think is very important: more and more, products are merely the physical manifestation of a service. As a result, even traditional product companies are seeing new revenue as they shore up their products with services. They’re also discovering the unique requirements of delivering software services.

Note that there’s a strong M2M thread here. As companies who haven’t been in the business of connecting devices to the ‘Net before jump in, they’re turning to M2M players to provide the infrastructure for that.

The result of this is that we’re getting things connected to the Internet. What’s not happening–yet–is connecting products to each other. I’ve taken to calling those “social products” after hearing Marc Benioff use that term. I don’t know if that’s what he meant, but that’s what I mean.

Tags:

kynetx


SaaS


service+economy


M2M


internet+of+things


social+products