send method
- SentMessage message
override
Implementation
@override
Future<void> send(SentMessage message) async {
final content = message.content;
if (content is! SentUserInput) {
return;
}
final LocalParticipant? localParticipant = _room.localParticipant;
if (localParticipant == null) {
throw StateError('Cannot send a message before connecting to the room.');
}
await localParticipant.sendText(
content.text,
options: SendTextOptions(topic: topic),
);
if (!_controller.isClosed) {
_controller.add(
ReceivedMessage(
id: message.id,
timestamp: message.timestamp,
content: UserInput(content.text),
),
);
}
}