Top of this document
Go directly to navigation
Go directly to page content

Open-CI: Notifications

Open-CI is about federating social networks, enabling users to share information between sites and use one user account to create works or create connections. In anyMeta everything is represented by 'things' that areconnected by 'edges'. Things could be persons, articles, events, organisations, etc. Edges always have a predicate to specify the nature of the connection. Examples include: participant, author, knows and likes.

To log onto another site, some representation of the person is required on that site. The same goes for when connections are made to things that are not on thesame site as the subject. To facilitate this, anyMeta also has things that are marked as non-authoritative. These are incomplete copies of one original thing (that is authoritative on its 'home' site) are mostly similar to authoritative things, but always refer to their original and have no page of their own. They basically act as proxies to their original.

Every thing in anyMeta has a corresponding XMPP Publish-Subscribe node. Using that node, one can receive instant notification of changes to their associated thing. This is similar to providing HTTP-based Atom feeds, which anyMeta also does, but uses a push model, instead of the polling nature of regular feeds.

Whenever a local representation of a foreign thing is required, a non-authoritative thing, that refers to that foreign thing, is created. The public data and outgoing edges of the foreign thing are retrieved and subsequently kept up-to-date by 'subscribing' to the node that corresponds to the foreign thing.

For example, if I log into Picnic Network with my Mediamatic account, a non-authoritative person thing is created at Picnic Network, pointing to the original at Mediamatic. Every time I show up on pages, as a friend or an author of an article or as a participant of an event, this local representation is used for the title, a short description and a thumbnail image. Now, when I change my description, I do this at Mediamatic, and a notification of that change is sent out to all subscribers, among which the Picnic Network site. The latter than updates its local representation of my person thing.

Similarly, for creating connections, if I add myself as a participant to a particular event, a new edge is created from my person thing to the thing that represents the event. Outgoing edges always belong to the subject of the connection, so if that event thing is at Picnic Network, the site will ask the Mediamatic site to create that edge. If the event has no local representation at the Mediamatic site, yet, it will be created by subscribing to it. Then, because the edge was created, a new notification for my change person thing is sent out to Picnic Network. This notification includes the new connection, so that Picnic Network can now show that I have added myself as partipant.

XMPP Notifications

The interchange format used in the cross-site notifications in Open-CI is the Atom Syndication Format. Atom is an XML language used for web feeds, and comes in to forms: feed documents and entry documents. The former is mostly used for the above mentioned HTTP poll-style feeds (that usually have more than one entry), while we use the latter for two things: per-thing HTTP feeds and our XMPP publish-subscribe notifications. The following is a an example of such a document as part of a message a subscriber to the publish-subscribe node for my person thing would get:

<message to="ralphm@ik.nu" from="pubsub.mediamatic.nl">
  <event xmlns="http://jabber.org/protocol/pubsub#event">
    <items node="generic/169e9f07-0fda-4583-a5cc-df142445b634">
      <item id="current">
        <entry xmlns="http://www.w3.org/2005/Atom"
               xmlns:anymeta="http://mediamatic.nl/ns/anymeta/"
               xml:lang="nl">
          <id>http://www.mediamatic.net/id/71101226-d816-102a-b311-0014385010dc</id>
          <updated>2009-02-22T21:55:59+01:00</updated>
          <link href="http://www.mediamatic.net/person/24879/nl"
                type="text/html"
                rel="alternate"/>
          <link href="http://www.mediamatic.net/foaf/24879"
                type="application/rdf+xml"
                rel="alternate"/>
          <title>Ralph Meijer</title>
          <subtitle>7' of protocol design</subtitle>
          <link href="http://fast.mediamatic.nl/f/sjnh/icon/287/24879-480-480-crop-.jpg"
                type="image/jpeg"
                rel="enclosure"
                title="FIGURE"/>
          <author>
            <name>-</name>
          </author>
          <link anymeta:symbolic_name="FIGURE"
                title="ralphm2.jpg"
                anymeta:predicate_title="figure"
                href="http://www.mediamatic.net/id/4bbf91a8-d817-102a-b311-0014385010dc"
                rel="http://xmlns.com/foaf/0.1/img"/>
          <link anymeta:symbolic_name="KNOWS"
                title="Nadya Peek"
                anymeta:predicate_title="knows"
                href="http://www.mediamatic.net/id/466b7b38-b95e-1028-8877-00baa71471f7"
                rel="http://purl.org/vocab/relationship/knowsOf"/>
          <link anymeta:symbolic_name="KNOWS"
                title="Jyri Engeström"
                anymeta:predicate_title="knows"
                href="http://www.picnicnetwork.org/id/014d2dde-55a3-102a-b311-0014385010dc"
                rel="http://purl.org/vocab/relationship/knowsOf"/>
          <link anymeta:symbolic_name="INTEREST"
                title="Federating Social Networks / SNES 00"
                anymeta:predicate_title="interested in"
                href="http://www.mediamatic.net/id/176e1a12-f074-102a-b311-0014385010dc"
                rel="http://xmlns.com/foaf/0.1/interest"/>
          <link anymeta:symbolic_name="INTEREST"
                title="Mobile Massage Couch"
                anymeta:predicate_title="interested in"
                href="http://www.mediamatic.net/id/a704ae47-d84c-102b-b6db-0014385010dc"
                rel="http://xmlns.com/foaf/0.1/interest"/>
          <link anymeta:symbolic_name="PARTICIPANT"
                title="Kom je ook?"
                anymeta:predicate_title="Participant"
                href="http://www.mediamatic.net/id/6cb8fdae-aec2-102b-b6db-0014385010dc"
                rel="http://purl.org/vocab/relationship/participantIn"/>
          <link anymeta:date_start_acc="d"
                anymeta:symbolic_name="WORKS_FOR"
                title="Mediamatic Lab"
                anymeta:predicate_title="My organisation"
                href="http://www.mediamatic.net/id/c12c20fe-b95c-1028-8877-00baa71471f7"
                anymeta:date_end_acc="d"
                anymeta:date_start="2007-10-29T00:00:00+01:00"
                rel="http://mediamatic.nl/ns/anymeta/2008/term/works_for"
                anymeta:date_end="2007-10-29T23:59:59+01:00"/>
          <category term="xmpp"/>
          <category term="anymeta"/>
          <category term="code"/>
          <anymeta:kind>PERSON</anymeta:kind>
        </entry>
      </item>
    </items>
  </event>
</message>

A few notes. The node identifier here is a UUID that was chosen by the publish-subscribe service upon node creation, as requested by the site. In our case, the same item is just overwritten upon a change, so it is called 'current'. The atom entry document itself has an http link that redirects to an HTML rendering of my person, has my name as the title and further contains links to images, acquaintances, things of interest and events I participated in. Some of the things linked to, are local, some on other sites. These links
correspond to the outgoing edges.

Discovery

Every time anyMeta wants to make a local, non-authoritative, copy of a remote thing, it needs to find out what node to subscribe to. Usually, it only knows some HTTP URI to the remote thing, and sometimes a title. To find out what XMPP publish-subscribe node represents a particular thing, each HTML representation contains a link element that points to the corresponding node. Any other site, or other entity, can just download the HTML page and find the link element that points tot the node, and then subscribe to that node. An example is:

<link rel="xmpp.feed"
      href="xmpp:pubsub.mediamatic.nl?;node=generic/169e9f07-0fda-4583-a5cc-df142445b634"
      title="XMPP updates for this item" />

The relationship here is 'xmpp.feed', and the linked resource is an XMPP URI that contains the Jabber ID of the publish-subscribe service (pubsub.mediamatic.nl) and the node identifier. In this case, it points to the same node as above.

Implementation

Currently, we use Idavoll as our publish-subscribe service. Idavoll is a server-side component that connects to a generic Jabber server. However, we could not use it directly. AnyMeta is written using PHP, which means that for each page request a PHP script is run, and if the page is done, the script ends. For XMPP, however, a persistent connection to the XMPP server is required.

To remedy this, we added an HTTP interface to Idavoll, so that our PHP scripts can send HTTP requests to Idavoll for publishing items and subscribing to remote nodes. When subscribing to remote nodes, a callback URI is passed along, so that Idavoll can send a request to the callback URI as soon as it receives notifications for those subscriptions.

Bijdragen 
Reacties