sendUserMessage

fun BaseChannel.sendUserMessage(message: String): Flow<MessageResult<UserMessage>>

Send user message

** Sample code **

baseChannel.sendUserMessage(paramsList)
.onEach {
when (it) {
is MessageResult.Pending -> {
// called it when sending message are called
// it contains pendingMessage
}
is MessageResult.Succeed -> {
// called it with result data when all job has been completed
}
is MessageResult.Failure -> {
// deliver exception with failed message when all job has been completed
// it.message : failed message
// it.e : exception
}
}
}.catch {
// error occurred (validation failed)
}.launchIn(viewModelScope)

Return

The user message

Since

4.15.0

Parameters

message

The message to send


fun BaseChannel.sendUserMessage(params: UserMessageCreateParams): Flow<MessageResult<UserMessage>>

Send user message ** Sample code **

baseChannel.sendUserMessage(params)
.onEach {
when (it) {
is MessageResult.Pending -> {
// called it when sending message are called
// it contains pendingMessage
}
is MessageResult.Succeed -> {
// called it with result data when all job has been completed
}
is MessageResult.Failure -> {
// deliver exception with failed message when all job has been completed
// it.message : failed message
// it.e : exception
}
}
}.catch {
// error occurred (validation failed)
}.launchIn(viewModelScope)

Return

The user message

Since

4.15.0

Parameters

params

The parameters to send user message