The swarm chat provides new possibilities for every device. Now, it's possible to sync history between devices by sharing the related repository. Devices sync needs to be redefined to follow those changes.
The swarm chat provides new possibilities for every device.
Now, it's possible to sync history between devices by sharing the related repository.
Devices sync needs to be redefined to follow those changes.
A lot of scenarios are defined in the {doc}`Swarm design document <swarm>`, however, this doesn't imply for syncing conversations between devices for the same user. Some new scenarios must be written.
A lot of scenarios are defined in the {doc}`Swarm design document <swarm>`, however, this doesn't imply for syncing conversations between devices for the same user.
Some new scenarios must be written.
## Old method
Device sync were done via the DHT. Because every value MUST NOT exceed 64k, conversations were not sent in device sync, nor member profiles, because it's too heavy. This is a problem and MUST be improved.
Device sync were done via the DHT. Because every value MUST NOT exceed 64k, conversations were not sent in device sync, nor member profiles, because it's too heavy.
This is a problem and MUST be improved.
In the old method, the daemon is listening on "inbox:DEVICE_ID" for DeviceSync values which contains the contact list to sync (cf. `AccountManager::startSync()`);
**NOTE:** The current **DeviceSync** value present on the **DHT** is deprecated with this draft.
```{note}
The current **DeviceSync** value present on the **DHT** is deprecated with this draft.
```
## New method
Since Jami has the {doc}`ConnectionManager <connection-manager>`, using p2p socket is possible to perform sync quickly with big values (cause the socket is not limited in data)
Since Jami has the {doc}`ConnectionManager <connection-manager>`, using p2p socket is possible to perform sync quickly with big values (cause the socket is not limited in data).
Now, this is the scenario used to sync:
1. When the device (*A*) goes online, it announces its presence via a DeviceAnnouncement like the OldMethod
1. When the device (*A*) goes online, it announces its presence via a DeviceAnnouncement like the OldMethod.
2. Other devices (*!A*) will detect that announce and will ask this device through the **ConnectionManager** to open a new channel named "sync://DEVICE_ID_A". (Note: A will get announcement from other devices, so it will asks for sync channels too).
3. As soon as this channel is opened, the device which is asking this channel will send a **DeviceSync** (cf. next part) value containing its known conversations and contacts.
4.*A* will check the **DeviceSync** value and:
...
...
@@ -30,7 +35,9 @@ Now, this is the scenario used to sync:
+ Remove conversation's requests if request is accepted (now in conversations)/declined
+ Add conversation's requests if detected
Note: If *A* detects new conversations, it will asks the device which announced that conversation to clone the repository through a git channel (so like described in {doc}`Swarm chat design <swarm>`)
```{note}
If *A* detects new conversations, it will asks the device which announced that conversation to clone the repository through a git channel (so like described in {doc}`Swarm chat design <swarm>`).