Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTC-512 Add Room.State module and peer disconnected timeout #178

Merged
merged 13 commits into from
Apr 17, 2024
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.lexical/*
compile_commands.json
.gdb_history
bundlex.sh
Expand Down
2 changes: 1 addition & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ config :membrane_telemetry_metrics, enabled: true

config :logger, :console,
format: "$time $metadata[$level] $message\n",
metadata: [:request_id, :room_id]
metadata: [:request_id, :room_id, :peer_id]

config :logger_json, :backend,
metadata: [:request_id, :room_id],
Expand Down
12 changes: 10 additions & 2 deletions lib/jellyfish/peer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ defmodule Jellyfish.Peer do
:type,
:engine_endpoint
]
defstruct @enforce_keys ++ [status: :disconnected, socket_pid: nil, tracks: %{}, metadata: nil]
defstruct @enforce_keys ++
[
status: :disconnected,
socket_pid: nil,
tracks: %{},
metadata: nil,
last_time_connected: nil
]

@type id :: String.t()
@type peer :: WebRTC
Expand All @@ -32,7 +39,8 @@ defmodule Jellyfish.Peer do
socket_pid: pid() | nil,
engine_endpoint: Membrane.ChildrenSpec.child_definition(),
tracks: %{Track.id() => Track.t()},
metadata: any()
metadata: any(),
last_time_connected: integer() | nil
}

@spec parse_type(String.t()) :: {:ok, peer()} | {:error, :invalid_type}
Expand Down
Loading