ConnectionReceiver


@RequiresApi(value = 26) interface ConnectionReceiver


Receiver callback for a RemoteConnection.

Summary

Public functions

Unit
onConnectionClosed(
    remoteConnection: RemoteConnection,
    error: Throwable?,
    reason: String?
)

Called when the remoteConnection is closed.

Unit
onMessageReceived(remoteConnection: RemoteConnection, payload: ByteArray)

Called when a message is received on the remoteConnection.

Public functions

onConnectionClosed

fun onConnectionClosed(
    remoteConnection: RemoteConnection,
    error: Throwable? = null,
    reason: String? = null
): Unit

Called when the remoteConnection is closed.

Parameters
remoteConnection: RemoteConnection

The remote connection that is closed.

error: Throwable? = null

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

reason: String? = null

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

onMessageReceived

fun onMessageReceived(remoteConnection: RemoteConnection, payload: ByteArray): Unit

Called when a message is received on the remoteConnection.