Skip to content

TextReceivedEvent

Lejla Solak edited this page Feb 10, 2025 · 2 revisions



getText()

Description

Getter for the text field.

Arguments

  • none

Returns

  • String - The value of the text field, which represents the received text.

Example

DataChannelEventListener dataChannelEventListener = new DefaultDataChannelEventListener() {
    @Override
    public void onTextReceived(TextReceivedEvent textReceivedEvent) {
        String text = textReceivedEvent.getText();
    }
};



getFrom()

Description

Getter for the from field.

Arguments

  • none

Returns

  • Endpoint - The value of the from field, which represents the endpoint from which the received text was sent.

Example

DataChannelEventListener dataChannelEventListener = new DefaultDataChannelEventListener() {
    @Override
    public void onTextReceived(TextReceivedEvent textReceivedEvent) {
        Endpoint from = textReceivedEvent.getFrom();
    }
};



getDate()

Description

Getter for the date field.

Arguments

  • none

Returns

  • Date - The value of the date field, which represents the time when the text was received.

Example

DataChannelEventListener dataChannelEventListener = new DefaultDataChannelEventListener() {
    @Override
    public void onTextReceived(TextReceivedEvent textReceivedEvent) {
        Date date = textReceivedEvent.getDate();
    }
};



isDirect()

Description

Getter for the direct field.

Arguments

  • none

Returns

  • boolean - The value of the direct field, indicating whether the received text was sent directly to its recipient or to all participants. If true, the text was sent directly, otherwise it was sent to everyone in the call.

Example

DataChannelEventListener dataChannelEventListener = new DefaultDataChannelEventListener() {
    @Override
    public void onTextReceived(TextReceivedEvent textReceivedEvent) {
        boolean isDirect = textReceivedEvent.isDirect();
    }
};

Tutorials

Migration guides

Reference documentation

Clone this wiki locally