publishMessage

inline suspend fun <T : Any> SyncStream.publishMessage(data: T): SyncStream.Message

Serializes the given value into an equivalent JsonObject using a serializer retrieved from reified type parameter and publish it as a new message to this SyncStream.

Type T must be annotated with @Serializable.

Parameters

data

Contains the payload of the dispatched message. Maximum size in serialized JSON: 4KB.

Throws

SerializationException

If the given value cannot be serialized to JSON object.

TwilioException

When error occurred while updating the document.


inline suspend fun <T : Any> Streams.publishMessage(sidOrUniqueName: String, data: T): SyncStream.Message

Serializes the given value into an equivalent JsonObject using a serializer retrieved from reified type parameter and publish it as a new message to this SyncStream without opening it.

Type T must be annotated with @Serializable.

Parameters

sidOrUniqueName

SID or unique name of existing SyncStream.

data

Contains the payload of the dispatched message. Maximum size in serialized JSON: 4KB.

Throws

SerializationException

If the given value cannot be serialized to JSON object.

TwilioException

When error occurred while updating the document.