Jido.Messaging.RoomSupervisor (Jido Messaging v1.0.0)

Copy Markdown View Source

DynamicSupervisor for spawning and managing RoomServer processes.

Each Jido.Messaging instance has its own RoomSupervisor that manages room servers on-demand.

Summary

Functions

Returns a specification to start this module under a supervisor.

Count running room servers

Get an existing room server or start a new one.

List all running room servers for this instance

Start a room server for the given room.

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

count_rooms(instance_module)

Count running room servers

get_or_start_room(instance_module, room, opts \\ [])

Get an existing room server or start a new one.

Returns {:ok, pid} in both cases.

list_rooms(instance_module)

List all running room servers for this instance

start_link(opts)

start_room(instance_module, room, opts \\ [])

Start a room server for the given room.

Returns {:ok, pid} if started successfully, or {:error, {:already_started, pid}} if the room server is already running.

Options:

  • :message_limit - Max messages to keep in memory (default: 100)
  • :timeout_ms - Inactivity timeout (default: 5 minutes)

stop_room(instance_module, room_id)

Stop a room server.

Returns :ok if stopped, or {:error, :not_found} if not running.