swarm icon indicating copy to clipboard operation
swarm copied to clipboard

Model sync

Open hongnk opened this issue 9 years ago • 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.

hongnk avatar Sep 25 '15 22:09 hongnk

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.

hongnk avatar Oct 30 '15 22:10 hongnk

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 [email protected] 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 https://github.com/gritzko/swarm/issues/65#issuecomment-152667435.

Victor

gritzko avatar Oct 31 '15 10:10 gritzko

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.

hongnk avatar Nov 06 '15 07:11 hongnk