[sugar] Collaboration in an activity
Wade Brainerd
wadetb at gmail.com
Sat May 17 17:32:12 EDT 2008
That's great that you're putting collaboration into Assimilate!
When a user joins an activity, they will have a brand new activity
instance. So there should be no merging of activity state needed.
Typically, you should just have joining users send a 'hello' message
when they establish a connection. The host (the user who initiated
the activity) responds with the entire database. Here is the code
from Colors!:
1. Function called when a connection finally exists. If I am not the
initiating client (i.e. if joining), broadcast a Hello message that
the initiator will hear:
http://dev.laptop.org/git?p=activities/colors;a=blob;f=colors.py;h=c262f55e46519248418a07e3c4eed1ab4207fa09;hb=a4e299e698ea90ef8dae62e3210cc02f7c51aafc#l664
2. The handler for the Hello message. If I am the initiating client,
respond with the entire state.
http://dev.laptop.org/git?p=activities/colors;a=blob;f=colors.py;h=c262f55e46519248418a07e3c4eed1ab4207fa09;hb=a4e299e698ea90ef8dae62e3210cc02f7c51aafc#l698
Hope this helps and feel free to ping me on IRC if you want to discuss it.
Best,
Wade
On Sat, May 17, 2008 at 12:44 PM, Urko Fernandez <tturktime at gmail.com> wrote:
> I've implemented some sort of collaboration on my activity. Code is in
> the repository
> (http://dev.laptop.org/git?p=activities/assimilate;a=summary)
>
> Whenever users are collaborating, everything works more or less, signals
> are send and received and all partners have the same content on their
> instances, but if a user goes offline, what's the best way to keep
> content in sync when she joins again the activity? Is there a way to
> store signals+data somewhere?
>
> I would like to know the best approach before I start coding anything in
> this regard, merging two async-ed activities seems a daunting task.
> Thanks again for all the help, I've ended up using D-Bus tubes to send
> the file at the beginning.
> Cheers,
>
> Urko
>
>>
>> Fyi: This is what Write does. It sends binary data over D-Bus tubes,
>> which sometimes (on the initial join, just like in your situation)
>> happens to be an entire word processing file. We never send Python
>> objects over the D-Bus tube.
>>
>> Marc
>>
>
> _______________________________________________
> Sugar mailing list
> Sugar at lists.laptop.org
> http://lists.laptop.org/listinfo/sugar
>
More information about the Sugar
mailing list