Message

sealed interface Message(source)

Represents a message that can be received through a WebRTC data channel. The message can contain either string data or binary data.

Report a problem

See also

Inheritors

Types

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open fun binaryOrNull(): ByteArray?

Returns the binary content of the message if it's a binary message, otherwise returns null.

Link copied to clipboard

Returns the binary content of the message if it's a binary message, otherwise throws an exception.

Link copied to clipboard
open fun textOrNull(): String?

Returns the text content of the message if it's a text message, otherwise returns null.

Link copied to clipboard
open fun textOrThrow(): String

Returns the text content of the message if it's a text message, otherwise throws an exception.