chat

Communication

Realtime Chat

Send and receive realtime room text and emoji messages through the authenticated Rust WebSocket.

Connect first

dart
await sdk.connectRoomSocket(
  roomId: roomId,
  userId: rustUserId,
  username: username,
);

Receive messages

dart
final subscription = sdk.roomMessages.listen((message) {
  print('${message.username}: ${message.message}');
});

Send text

dart
final clientMessageId = await sdk.sendRoomMessage(
  roomId: roomId,
  message: 'Hello room',
  type: 'text',
  metadata: {'source': 'flutter'},
);

Send emoji

dart
await sdk.sendRoomEmoji(
  roomId: roomId,
  emoji: '🎉',
);

Custom events

dart
await sdk.sendRoomEvent(
  type: 'ReactionSent',
  data: {'emoji': '❤️'},
);

History

The Rust server exposes GET /rooms/:room_id/chat and POST /rooms/:room_id/chat. The current SDK emphasizes WebSocket chat; add REST history through RoomChatService only if your installed SDK release exports those methods.

Images, files, and voice-message upload helpers are not part of the stable 2.0.0 public chat API.