View Source Jellyfish.Room (Jellyfish Server SDK v0.1.1)
Utilities for manipulating the rooms.
examples
Examples
iex> {:ok, room} = Jellyfish.Room.create(client, max_peers: 10)
{:ok,
%Jellyfish.Room{
components: [],
config: %{max_peers: 10},
id: "d3af274a-c975-4876-9e1c-4714da0249b8",
peers: []
}}
iex> {:ok, peer, peer_token} = Jellyfish.Room.add_peer(client, room.id, "webrtc")
{:ok,
%Jellyfish.Peer{id: "5a731f2e-f49f-4d58-8f64-16a5c09b520e", type: "webrtc"},
"3LTQ3ZDEtYTRjNy0yZDQyZjU1MDAxY2FkAAdyb29tX2lkbQAAACQ0M"}
iex> :ok = Jellyfish.Room.delete(client, room.id)
:ok
Link to this section Summary
Types
Id of the room, unique within Jellyfish instance.
Type describing room options.
Peer token, created by Jellyfish. Required by client application to open connection to Jellyfish.
Stores information about the room.
Functions
Add component to the room with room_id
.
Add a peer to the room with room_id
.
Create a room.
Delete the room with room_id
.
Delete the component with component_id
from the room with room_id
.
Delete the peer with peer_id
from the room with room_id
.
Get metadata of the room with room_id
.
List metadata of all of the rooms.
Link to this section Types
@type id() :: String.t()
Id of the room, unique within Jellyfish instance.
@type options() :: [{:max_peers, non_neg_integer()}]
Type describing room options.
:max_peers
- maximum number of peers present in a room simultaneously. Unlimited, if not specified.
@type peer_token() :: String.t()
Peer token, created by Jellyfish. Required by client application to open connection to Jellyfish.
@type t() :: %Jellyfish.Room{ components: [Jellyfish.Component.t()], config: map(), id: id(), peers: [Jellyfish.Peer.t()] }
Stores information about the room.
Link to this section Functions
@spec add_component( Jellyfish.Client.t(), id(), Jellyfish.Component.type(), Jellyfish.Component.options() ) :: {:ok, Jellyfish.Component.t()} | {:error, atom() | String.t()}
Add component to the room with room_id
.
@spec add_peer(Jellyfish.Client.t(), id(), Jellyfish.Peer.type()) :: {:ok, Jellyfish.Peer.t(), peer_token()} | {:error, atom() | String.t()}
Add a peer to the room with room_id
.
@spec create(Jellyfish.Client.t(), options()) :: {:ok, t()} | {:error, atom() | String.t()}
Create a room.
@spec delete(Jellyfish.Client.t(), id()) :: :ok | {:error, atom() | String.t()}
Delete the room with room_id
.
@spec delete_component(Jellyfish.Client.t(), id(), Jellyfish.Component.id()) :: :ok | {:error, atom() | String.t()}
Delete the component with component_id
from the room with room_id
.
@spec delete_peer(Jellyfish.Client.t(), id(), Jellyfish.Peer.id()) :: :ok | {:error, atom() | String.t()}
Delete the peer with peer_id
from the room with room_id
.
@spec get(Jellyfish.Client.t(), id()) :: {:ok, t()} | {:error, atom() | String.t()}
Get metadata of the room with room_id
.
@spec get_all(Jellyfish.Client.t()) :: {:ok, [t()]} | {:error, atom() | String.t()}
List metadata of all of the rooms.