Ditto provides mechanisms to control who you sync with, such as sync groups and the connectionRequestHandler
API method. This article provides guidance on how to use these mechanisms to manage which devices sync with each other, even within the same App.
connectionRequestHandler
API method, you can intercept new peer connections and make decisions to accept or reject them based on the peer metadata set for a given device. (See Setting the Connection Request Handler)
Within the connectionRequestHandler
you can use the connectionRequest
parameter to access information about the peer connection request. (See Reading Connection Parameters)
string
that uniquely identifies the requesting peer once discovered within the mesh.7890
and 1234
. When a peer establishes its identity with Ditto Server, it includes its location ID as part of the authentication callback.
Now, the two groups maintain isolated mesh networks: