ConnectionLifecycleCallback

public abstract class ConnectionLifecycleCallback extends Object

Listener for lifecycle events associated with a connection to a remote endpoint.

Public Constructor Summary

Public Method Summary

abstract void
onConnectionInitiated(String endpointId, ConnectionInfo connectionInfo)
A basic encrypted channel has been created between you and the endpoint.
abstract void
onConnectionResult(String endpointId, ConnectionResolution resolution)
Called after both sides have either accepted or rejected the connection.
abstract void
onDisconnected(String endpointId)
Called when a remote endpoint is disconnected or has become unreachable.

Inherited Method Summary

Public Constructors

public ConnectionLifecycleCallback ()

Public Methods

public abstract void onConnectionInitiated (String endpointId, ConnectionInfo connectionInfo)

A basic encrypted channel has been created between you and the endpoint. Both sides are now asked if they wish to accept or reject the connection before any data can be sent over this channel.

This is your chance, before you accept the connection, to confirm that you connected to the correct device. Both devices are given an identical token; it's up to you to decide how to verify it before proceeding. Typically this involves showing the token on both devices and having the users manually compare and confirm; however, this is only required if you desire a secure connection between the devices.

Whichever route you decide to take (including not authenticating the other device), call acceptConnection(String, PayloadCallback) when you're ready to talk, or rejectConnection(String) to close the connection.

Parameters
endpointId The identifier for the remote endpoint.
connectionInfo Other relevant information about the connection.

public abstract void onConnectionResult (String endpointId, ConnectionResolution resolution)

Called after both sides have either accepted or rejected the connection. If the ConnectionResolution's status is SUCCESS, both sides have accepted the connection and may now send Payloads to each other. Otherwise, the connection was rejected.

Parameters
endpointId The identifier for the remote endpoint.
resolution The final result after tallying both devices' accept/reject responses.

public abstract void onDisconnected (String endpointId)

Called when a remote endpoint is disconnected or has become unreachable.

Parameters
endpointId The identifier for the remote endpoint that disconnected.