joinRoom method

  1. @override
Future<Either<RealtimeFailure, Unit>> joinRoom(
  1. Object roomName, {
  2. String joinMethod = 'JoinRoom',
})
override

Joins a chat room, channel, or video call group.

Automatically tracked: active rooms are automatically re-joined upon reconnection.

roomName is sent to joinMethod exactly as given, on the first join and on every rejoin, so pass whatever type the hub parameter declares: joinRoom(42, joinMethod: 'JoinChatGroup') for JoinChatGroup(int chatId). A string "42" would not bind to that int. The room is tracked in activeRooms under its string form, which is also what leaveRoom matches on.

Implementation

@override
Future<Either<RealtimeFailure, Unit>> joinRoom(
  Object roomName, {
  String joinMethod = 'JoinRoom',
}) async {
  _rooms.add(RoomManager.keyFor(roomName));
  _invocations.add({
    'method': joinMethod,
    'args': [roomName]
  });
  return const Right(unit);
}