Collaboration Tutorial

From OLPC
Revision as of 15:27, 16 November 2007 by Morgs (talk | contribs) (How to use Tubes!!!)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This tutorial focuses on activity sharing.

Collaboration is implemented with Telepathy, a D-Bus framework for Instant Messaging protocols. The Presence Service provides functionality to Sugar to track shared Activities and Buddies, and talks to Telepathy connection managers for XMPP via a Jabber server (telepathy-gabble), and Link Local XMPP (telepathy-salut).

XMPP is used to provide presence information about Buddies (other XOs you can collaborate with). The mesh view is like an instant messenger buddy list, represented in a more graphical way.

Not all the Buddies you see are on the same network as you. In particular, any of them could be behind a NAT firewall, and so you cannot simply open a TCP/IP socket to them to exchange data.

XMPP via the Jabber server on the school server allows you to exchange data with all the Buddies you can see, whether or not they are directly reachable from your XO.

Chat Rooms

A shared activity is implemented using an XMPP MUC (multi user chat room). Buddies that are in the room, are in the shared activity.

PresenceService provides each shared activity with a Telepathy Text Channel by default. This text channel is a connection to the XMPP chat room, but is not useful for data sharing directly. You can see an example of this Text Channel in direct use in the Chat activity. In future, Sugar will provide "overlay chat" to activities, allowing you to do text chat with the participants of a shared activity.

On top of this Text Channel, we use a dbus Tubes channel to exchange data.

Tubes!!!

There are two types of Tubes at present: D-Bus Tubes and Stream Tubes.

D-bus Tubes provide D-bus functionality to signal and call methods on everyone in the room.

Stream Tubes wrap TCP/IP sockets and are more suited to streaming data between two participants.

D-Bus Tubes

See the [D-Bus tutorial] and the [dbus-python tutorial].

D-Bus provides signals and methods.

Signals are multicast - they are sent to all participants in the shared activity (including the sender). They send data and have no return value.

Method calls are called on a single participant, and they do have a return value.

More to come here...

HelloMesh example

HelloMesh uses a D-Bus Tube. The code is in git://dev.laptop.org/projects/hellomesh and can be built in sugar-jhbuild with ./sugar-jhbuild buildone hellomesh.

More to come here...

Stream Tubes

See the Read activity's code for an example. It's in git://dev.laptop.org/projects/read-activity and is built by default in sugar-jhbuild.

More to come here...