gritzko/swarm

Model sync

hongnk opened this issue · 3 comments

I'm still trying to understand how Swarm works for collaborated editing.

Supposed one site created a new object extending a predefined model, how that new object be replicated to another site? I did observe an object with same ID that is already defined on both sites would be piped through, but a new object with new ID didn't seem to do so.

Perhaps I don't understand the flow clearly for the above? A code example will be great.

Now I understand that the server side only forward models to listeners with known IDs. Perhaps new IDs need some sort of reference to be able to find listeners it must replicate to. I found Syncable.Ref in the code but not sure how it could be used. I hope there could be a way to define channel ID, where all objects belong to a channel would be replicated, regardless of object ID.

Swarm is not channel-based. It is object-based.
The typical approach is to put your objects into a collection with a
predefined id, then open that collection.
That way, a collection works as a "channel".

On 30 October 2015 at 23:39, hongnk notifications@github.com wrote:

Now I understand that the server side only forward models to listeners
with known IDs. Perhaps new IDs need some sort of reference to be able to
find listeners it must replicate to. I found Syncable.Ref in the code but
not sure how it could be used. I hope there could be a way to define
channel ID, where all objects belong to a channel would be replicated,
regardless of object ID.


Reply to this email directly or view it on GitHub
#65 (comment).

Victor

Yes I thiink that works. The trick is to create a collection of Syncable.Ref, then all objects referenced in that collection will be replicated.