Data Sync
Creating Sync Groups
a sync group is a collection of devices organized into a distinct group, allowing you to limit connections to specific subsets of devices rather than the default behavior of connecting all devices sharing the same app id introduction by default, devices with the same app id automatically form a mesh network to connect however, you can streamline sync processes, minimize unnecessary data transfer, and optimize resource usage by configuring sync groups within your app for example, the following graphic illustrates two distinct restaurants identified by their location ids 7890 and 1234 when a peer establishes its identity with the big peer, it includes its location id as part of the authentication callback now, the two groups maintain isolated mesh networks access controls by group sync groups are an optimization, not a security control — if a connection is created manually, such as by specifying a connecting transport, then devices from different sync groups will still sync as normal to enforce access controls by group, for instance, two groups of devices, each accessing different datasets, use ditto's permissions system (see docid\ lqp70n83mjob9wtojpnrw ) the syncgroup parameter provides this functionality a device can only ever be in one sync group, which by default is group 0 up to 2^32 distinct group numbers can be used in an app using a sync group is more performant, and is recommended in any case where this knowledge is known ahead of time setting up sync groups to create a sync group var config = dittotransportconfig() config global syncgroup = 1234 ditto transportconfig = config do { try ditto startsync() } catch (let error) { print(error localizeddescription) }val config = dittotransportconfig() config global syncgroup = 1234u ditto transportconfig = config ditto startsync()const config = new transportconfig() config global syncgroup = 1234 ditto settransportconfig(config) ditto startsync()// not supported in javadittotransportconfig transportconfig = new dittotransportconfig(); transportconfig global syncgroup = 1234; ditto transportconfig = transportconfig; ditto startsync();auto config = ditto transportconfig(); config global sync group = 1234; ditto set transport config(config); ditto start sync();let mut config = transportconfig new(); config global sync group = 1234; ditto set transport config(config); ditto start sync()?;