connection Request Handler
Set this handler to control which peers in a Ditto mesh can connect to the current peer.
Each peer in a Ditto mesh will attempt to connect to other peers that it can reach. By default, the mesh will try and establish connections that optimize for the best overall connectivity between peers. However, you can set this handler to assert some control over which peers you connect to.
If set, this handler is called for every incoming connection request from a remote peer and is passed the other peer's DittoPeer.peerKey, DittoPeer.peerMetadata, and DittoPeer.identityServiceMetadata. The handler can then accept or reject the request by returning an according DittoConnectionRequestAuthorization value. When the connection request is rejected, the remote peer may retry the connection request after a short delay.
Connection request handlers must reliably respond to requests within a short time. If a handler takes too long to respond or throws an exception, the connection request will be denied. The response timeout is currently 10 seconds but may be subject to change in future releases.
Note: The handler is called from a different thread.
Since
4.7.0