Data Sync
Advanced Customizations
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 specific peer to connect to, then devices from different sync groups will still connect and 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\ hrv1c0ofsvhppljevx8r2 ) a device can only be in one sync group, which by default is group 0 up to 2^32 distinct group numbers can be used in an app setting up sync groups to create a sync group ditto transportconfig global syncgroup = 1234 do { try ditto startsync() } catch (let error) { print(error localizeddescription) }ditto transportconfig global syncgroup = 1234u ditto startsync()const config = new transportconfig() config global syncgroup = 1234 ditto settransportconfig(config) ditto startsync()// not supporteddittotransportconfig transportconfig = new dittotransportconfig(); transportconfig global syncgroup = 1234; ditto transportconfig global syncgroup = 1234; 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()?;final config = transportconfig() global syncgroup = 1234; await ditto settransportconfig(config); await ditto startsync();