DataReceived

class DataReceived(val room: Room, val data: ByteArray, val participant: RemoteParticipant?, val topic: String?, val encryptionType: <Error class: unknown class>, val participantIdentity: String = "") : RoomEvent

Received data published by another participant

participant is null when the sender is not in the room, such as data published through the Server API or by a participant that has already left. Use participantIdentity to attribute the data in that case.

room.events.collect { event ->
if (event is RoomEvent.DataReceived) {
val sender = event.participant?.identity?.value ?: event.participantIdentity
println("$sender sent ${event.data.size} bytes")
}
}

Parameters

data

the published data

participant

the participant if available

Constructors

Link copied to clipboard
constructor(room: Room, data: ByteArray, participant: RemoteParticipant?, topic: String?, encryptionType: <Error class: unknown class>)

Retains the pre-participantIdentity JVM constructor signature, so modules compiled against an earlier SDK keep linking. A Kotlin default argument alone would not: it emits the full-arity constructor plus a synthetic one, and the old five-argument signature would disappear.

constructor(room: Room, data: ByteArray, participant: RemoteParticipant?, topic: String?, encryptionType: <Error class: unknown class>, participantIdentity: String = "")

Properties

Link copied to clipboard
Link copied to clipboard
val encryptionType: <Error class: unknown class>
Link copied to clipboard
Link copied to clipboard

Identity of the sender. Reported even when participant is null because the sender is not (or is no longer) a participant in this room.

Link copied to clipboard
val room: Room
Link copied to clipboard