amazon-chime-sdk / com.amazonaws.services.chime.sdk.meetings.realtime / DefaultRealtimeController / realtimeSendDataMessage

# realtimeSendDataMessage

`fun realtimeSendDataMessage(topic: String, data: Any, lifetimeMs: Int): Unit`

Send message via data channel. Messages are only expected to be sent after audio video has started, otherwise will be ignored. Even though one can send data messages to any valid topic, in order to receive the messages from the given topic, one need to subscribed to the topic by calling addRealtimeDataMessageObserver. LifetimeMs specifies milliseconds for the given message can be stored in server side. Up to 1024 messages may be stored for a maximum of 5 minutes.

### Parameters

`topic` - : String - topic the message is sent to

`data` - : Any - data payload, it can be ByteArray, String or other serializable object, which will be convert to ByteArray

`lifetimeMs` - : Int - the milliseconds of lifetime that is available to late subscribers, default as 0

### Exceptions

`InvalidParameterException` - when topic is not match regex `^[a-zA-Z0-9_-]{1,36}$`, or data size is over 2kb, or lifetime ms is negative