ConnectionReceiver


@RequiresApi(value = 26) interface ConnectionReceiver


Receiver callback for a RemoteConnection.

Summary

Public methods

abstract void
onConnectionClosed(
    @NonNull RemoteConnection remoteConnection,
    Throwable error,
    String reason
)

Called when the remoteConnection is closed.

abstract void
onMessageReceived(
    @NonNull RemoteConnection remoteConnection,
    @NonNull byte[] payload
)

Called when a message is received on the remoteConnection.

Public methods

onConnectionClosed

abstract void onConnectionClosed(
    @NonNull RemoteConnection remoteConnection,
    Throwable error,
    String reason
)

Called when the remoteConnection is closed.

Parameters
@NonNull RemoteConnection remoteConnection

The remote connection that is closed.

Throwable error

The error causing the connection to be closed, or null if the connection was closed normally.

String reason

The reason indicated by the remote end of the connection in their call to RemoteConnection.close.

onMessageReceived

abstract void onMessageReceived(
    @NonNull RemoteConnection remoteConnection,
    @NonNull byte[] payload
)

Called when a message is received on the remoteConnection.