-
Notifications
You must be signed in to change notification settings - Fork 2
DataChannelEventListener
Lejla Solak edited this page Oct 26, 2023
·
1 revision
void onTextDelivered(TextDeliveredEvent textDeliveredEvent)
void onTextReceived(TextReceivedEvent textReceivedEvent)
void onBroadcastTextReceived(BroadcastTextReceivedEvent broadcastTextReceivedEvent)
Method that is triggered when the previously sent text has been (un)successfully delivered.
-
textDeliveredEvent
:TextDeliveredEvent
- Event instance containing additional information about the delivered text.
N/A
DataChannelEventListener dataChannelEventListener = new DefaultDataChannelEventListener() {
@Override
public void onTextDelivered(TextDeliveredEvent textDeliveredEvent) {
if (textDeliveredEvent.isDelivered()) {
Log.d("WebRTC", String.format("Successfully delivered text with id: %s", textDeliveredEvent.getId()));
} else {
Log.e("WebRTC", String.format("Failed to deliver text with id: %s", textDeliveredEvent.getId()));
}
}
});
Method that is triggered when the new text has been received.
-
textReceivedEvent
:TextReceivedEvent
- Event instance containing additional information about the received text.
N/A
DataChannelEventListener dataChannelEventListener = new DefaultDataChannelEventListener() {
@Override
public void onTextReceived(TextReceivedEvent textReceivedEvent) {
if (textReceivedEvent.isDirect()) {
Log.d("WebRTC", String.format("Received direct text from %s: %s", textReceivedEvent.getFrom().identifier(), textReceivedEvent.getText()));
} else {
Log.d("WebRTC", String.format("Received text from %s: %s", textReceivedEvent.getFrom().identifier(), textReceivedEvent.getText()));
}
}
});
Method triggered when a broadcast has been received. A broadcast is a message that is
sent to all conference or dialog participants with an open DataChannel
by invoking
Calls API methods for conferences
and dialogs respectively.
-
broadcastTextReceivedEvent
:BroadcastTextReceivedEvent
- Event instance containing additional information about the received broadcasted text.
N/A
DataChannelEventListener dataChannelEventListener = new DefaultDataChannelEventListener() {
@Override
public void onBroadcastTextReceived(BroadcastTextReceivedEvent broadcastTextReceivedEvent) {
Log.d("WebRTC", String.format("Received broadcasted text: %s", broadcastTextReceivedEvent.getText()));
}
});