# `Jido.Messaging.RoomServer`
[🔗](https://github.com/agentjido/jido_messaging/blob/v1.0.0/lib/jido_messaging/room_server.ex#L1)

GenServer that manages a single room's state.

Each room has its own process that holds:
- The Room struct
- Bounded message history
- Active participants

Rooms are started on-demand and hibernate after inactivity.

# `t`

```elixir
@type t() :: %Jido.Messaging.RoomServer{
  instance_module: any(),
  message_limit: integer(),
  messages: [
    %Jido.Messaging.Message{
      content: term(),
      delivery_external_room_id: term(),
      external_id: term(),
      external_reply_to_id: term(),
      external_thread_id: term(),
      id: term(),
      inserted_at: term(),
      metadata: term(),
      reactions: term(),
      receipts: term(),
      reply_to_id: term(),
      role: term(),
      room_id: term(),
      sender_id: term(),
      status: term(),
      thread_id: term(),
      updated_at: term()
    }
  ],
  participants: map(),
  registered_agents: map(),
  room: %Jido.Chat.Room{
    external_bindings: term(),
    id: term(),
    inserted_at: term(),
    metadata: term(),
    name: term(),
    type: term()
  },
  thread_assignments: map(),
  timeout_ms: integer(),
  typing: map(),
  typing_timeout_ms: integer()
}
```

# `add_message`

Add a message to the room's history

# `add_participant`

Add or update a participant in the room

# `add_reaction`

Add a reaction to a message

# `assign_thread`

Assign a thread to an agent

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `get_agent`

Fetch one registered agent

# `get_agent_pids`

Get list of agent PIDs participating in a room

# `get_messages`

Get messages from the room's history.

Options:
- `:limit` - Max messages to return (default: all)

# `get_participants`

Get all participants in the room

# `get_room`

Get the room struct

# `get_state`

Get the current room server state

# `get_typing`

Get currently typing participants

# `list_agents`

List registered agents

# `list_thread_assignments`

List thread assignments

# `mark_delivered`

Mark a message as delivered to a participant

# `mark_read`

Mark a message as read by a participant

# `register_agent`

Register an agent with the room

# `remove_participant`

Remove a participant from the room

# `remove_reaction`

Remove a reaction from a message

# `schema`

Returns the Zoi schema

# `set_typing`

Set typing status for a participant

# `start_link`

Start a RoomServer for the given room.

Options:
- `:room` - Required. The Room struct or room attributes
- `:instance_module` - Required. The Jido.Messaging instance module
- `:message_limit` - Optional. Max messages to keep (default: 100)
- `:timeout_ms` - Optional. Inactivity timeout before hibernation (default: 5 min)

# `thread_assignment`

Get thread assignment

# `unassign_thread`

Unassign a thread

# `unregister_agent`

Unregister an agent from the room

# `update_presence`

Update a participant's presence status

# `via_tuple`

Generate a via tuple for Registry-based process lookup

# `whereis`

Check if a room server is running

---

*Consult [api-reference.md](api-reference.md) for complete listing*
