ottypes / docs

277 stars 29 forks source link

Presence for OT Types #29

Open curran opened 5 years ago

curran commented 5 years ago

Presence, meaning for example where others' cursors are, is an essential feature of real time collaborative systems. Without it, the experience of real time collaboration suffers greatly. When it comes to implementing presence, one of the tricky bits is transforming presence by ops. Since various OT types will transform presence in different ways, it makes sense to have each OT type define its own presence data structure and transformation algorithm.

This work has been underway for some time now, but I wanted to make this issue to discuss the core of the work - namely, whether or not this feature stands a chance at becoming an "official" part of the OT implementation recommendataion/docs within the ottypes organization. This would be an improvement over the current situation, where the feature is implemented and maintained solely in a fork or multiple divergent forks.

This PR Add presence-related properties #27 introduces the following new methods:

I personally am only totally convinced that we need transformPresence(presence, op). The experience of actually implementing the feature may prove the need for the others.

Related reading:

With this issue I'd like to open a discussion about high level questions around presence, like:

/cc @josephg @nateps @ericyhwang @gkubisa @mdaines @houshuang @jhchen

gkubisa commented 5 years ago

The new presence-related functions are needed for presence as implemented in @teamwork/sharedb. I'm the author of that feature, yet I realise that it might not represent the optimal design. I see it more like a compromise which allows it to work with the current implementation of ShareDB. Consequently, I'd recommend careful evaluation before baking it into the ottypes spec.

PS. An alternative presence design could treat presence data (eg caret position, selection, etc) as a part of ops and snapshots, with a separate "connection-level" module determining who is actually online right now and which carets/selections should be displayed.