Interface DittoPresence.ConnectionRequestHandler
- Enclosing class:
DittoPresence
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Handler interface for controlling incoming connection requests.
Implement this interface to control which peers are allowed to connect to the local peer.
The handler is called for each incoming connection request and must return a
DittoConnectionRequestAuthorization to accept or reject the connection.
Important: Handlers must respond within 10 seconds or the connection will be automatically denied. Handlers should not throw exceptions.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionhandleConnectionRequest(@NonNull DittoConnectionRequest request) Handles an incoming connection request from a remote peer.
-
Method Details
-
handleConnectionRequest
CompletionStage<DittoConnectionRequestAuthorization> handleConnectionRequest(@NonNull DittoConnectionRequest request) Handles an incoming connection request from a remote peer.
This method is called from a different thread when a remote peer attempts to connect. Evaluate the connection request and return a
CompletionStagethat completes with aDittoConnectionRequestAuthorizationindicating whether to allow or deny the connection.- Parameters:
request- theDittoConnectionRequestcontaining information about the requesting peer.- Returns:
- a
CompletionStagethat completes with the authorization decision.
-