This is an old thread, but unanswered, so I wanted to follow-up.

We hope to provide a server-side timestamp for gadget deltas, whether
via getTime or another means. This issue tracks that:
http://code.google.com/p/google-wave-resources/issues/detail?id=285

We hope also to provide a way to "OT-enable" text within a gadget, so
that developers don't have to try to write their own text
collaboration on top of the gadgets API.

The "GoogleFight!" gadget claims to have implemented a degree of
collaborative text-editing inside a gadget; it may be worth looking at
that in the meantime.
http://wave-samples-gallery.appspot.com/about_app?app_id=78007

- pamela


On Thu, Oct 15, 2009 at 3:27 PM, Jonathan Hunt <[email protected]> wrote:
>
> Hi,
>
> I have a question about the best way to manage state changes with an
> interactive gadget. My gadget has a textbox for user's to write an
> equation in (http://waveyscience.appspot.com). Every time the user
> types in the textbox I change the stored equation (submitDelta). I
> don't want to wait until they leave the textbox so that other user's
> can see any changes they make right away. Now the problem is that, for
> the user's who haven't edited the textbox, upon receiving a
> stateUpdated event they need to update the textbox, but the editing
> user may have written another character in the mean time and I
> wouldn't be polite to overwrite that.
>
> At the moment I get around this by having a variable "lastUpdate"
> which records the last state update submitted, and ignores state
> changes until the lastUpdate state change is received. This means if
> user types "a" and then "b" generating state changes "a" and "ab"
> quickly, the stateUpdated event with just the state change 'a' (which
> will occur after both keypresses if typing quickly) will get ignored
> in the originating gadget (because it is waiting for the state change
> 'ab' which it know's it has submitted). This seems to work. The only
> problem is, that (I think) if another user types 'c' quickly, then the
> state might get merge on the server and so the state change to 'ab'
> will never be received by the gadget. This leaves it in a stuck state
> waiting for state change that will never come and ignoring other ones.
>
> One hack would be to have some sort of timeout. But it seems like a
> better way would be to have submitDelta give some sort of server side
> timestamp, so one can test in statedUpdated if that delta is still
> pending or a newer state is now available. getTime seems like it might
> be the kinda thing I'm after but I can't really see how to use it, and
> at the moment I think it just gives the client time (which won't work
> if the client clocks are out of sync (and they'd only need to be out
> by milliseconds).
>
> Basically, what I'm asking is, does anyone have a demo implementation
> of a gadget that is just a textbox editable by multiple users,
> synchronizing with each keypress. I don't quite understand the Wave
> way to do this, as gadget's don't have access to the full Wave OT.
>
> Thanks for any help.
> Jonny
> --
> Jonathan J Hunt <[email protected]>
> Homepage: http://www.42quarks.com
> (Further contact details there)
> "Physics isn't the most important thing. Love is." Richard Feynman
>
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups 
> "Google Wave API" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to 
> [email protected]
> For more options, visit this group at 
> http://groups.google.com/group/google-wave-api?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
>

--

You received this message because you are subscribed to the Google Groups 
"Google Wave API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en.


Reply via email to