Skip to content

Commit

Permalink
Rename Jellyfish to Fishjam (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
mickel8 authored May 17, 2024
1 parent 49df86c commit ecd7971
Show file tree
Hide file tree
Showing 41 changed files with 347 additions and 357 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "protos"]
path = protos
url = https://github.com/jellyfish-dev/protos.git
url = https://github.com/fishjam-dev/protos.git
branch = master
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ Currently it allows for:

## Installation

The package can be installed by adding `jellyfish_server_sdk` to your list of dependencies in `mix.exs`:
The package can be installed by adding `fishjam_server_sdk` to your list of dependencies in `mix.exs`:

```elixir
def deps do
[
{:jellyfish_server_sdk, "~> 0.5.0"}
{:fishjam_server_sdk, "~> 0.6.0"}
]
end
```
Expand All @@ -29,22 +29,22 @@ Define the connection configuration in the mix config,
specifying server address and authentication token
(for more information see [Fishjam docs](https://fishjam-dev.github.io/fishjam-docs/getting_started/authentication))
``` config.exs
config :jellyfish_server_sdk,
config :fishjam_server_sdk,
server_address: "localhost:5002",
server_api_token: "your-jellyfish-token",
server_api_token: "your-fishjam-token",
secure?: true
```

Alternatively, the connection options can be provided when creating a `Jellyfish.Client` or starting `Jellyfish.WSNotifier`:
Alternatively, the connection options can be provided when creating a `Fishjam.Client` or starting `Fishjam.WSNotifier`:

```elixir
client =
Jellyfish.Client.new(server_address: "localhost:5002", server_api_token: "your-jellyfish-token")
Fishjam.Client.new(server_address: "localhost:5002", server_api_token: "your-fishjam-token")

{:ok, notifier} =
Jellyfish.WSNotifier.start(
Fishjam.WSNotifier.start(
server_address: "localhost:5002",
server_api_token: "your-jellyfish-token"
server_api_token: "your-fishjam-token"
)
```

Expand All @@ -54,29 +54,29 @@ Make API calls to Fishjam and receive server events:

```elixir
# start process responsible for receiving events
{:ok, notifier} = Jellyfish.WSNotifier.start()
:ok = Jellyfish.WSNotifier.subscribe_server_notifications(notifier)
{:ok, notifier} = Fishjam.WSNotifier.start()
:ok = Fishjam.WSNotifier.subscribe_server_notifications(notifier)

# create HTTP client instance
client = Jellyfish.Client.new()
client = Fishjam.Client.new()

# Create room
{:ok, %Jellyfish.Room{id: room_id}, jellyfish_address} = Jellyfish.Room.create(client, max_peers: 10)
{:ok, %Fishjam.Room{id: room_id}, fishjam_address} = Fishjam.Room.create(client, max_peers: 10)

room_id
# => "8878cd13-99a6-40d6-8d7e-8da23d803dab"

# Add peer
{:ok, %Jellyfish.Peer{id: peer_id}, peer_token} =
Jellyfish.Room.add_peer(client, room_id, Jellyfish.Peer.WebRTC)
{:ok, %Fishjam.Peer{id: peer_id}, peer_token} =
Fishjam.Room.add_peer(client, room_id, Fishjam.Peer.WebRTC)

receive do
{:jellyfish, %Jellyfish.Notification.PeerConnected{room_id: ^room_id, peer_id: ^peer_id}} ->
{:fishjam, %Fishjam.Notification.PeerConnected{room_id: ^room_id, peer_id: ^peer_id}} ->
# handle the notification
end

# Delete peer
:ok = Jellyfish.Room.delete_peer(client, room_id, peer_id)
:ok = Fishjam.Room.delete_peer(client, room_id, peer_id)
```

List of structs representing events can be found in the [docs](https://hexdocs.pm/fishjam_server_sdk).
Expand Down
4 changes: 2 additions & 2 deletions compile_proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ git submodule sync --recursive >> /dev/null
git submodule update --recursive --remote --init >> /dev/null
printf "DONE\n\n"

server_file="./protos/jellyfish/server_notifications.proto"
server_file="./protos/fishjam/server_notifications.proto"
printf "Compiling: file $server_file"
protoc --elixir_out=./lib/ $server_file
printf "\tDONE\n"

peer_file="./protos/jellyfish/peer_notifications.proto"
peer_file="./protos/fishjam/peer_notifications.proto"
printf "Compiling: file $peer_file"
protoc --elixir_out=./test/support $peer_file
printf "\tDONE\n"
Expand Down
2 changes: 1 addition & 1 deletion config/dev.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Config

config :jellyfish_server_sdk,
config :fishjam_server_sdk,
server_address: "localhost:5002",
server_api_token: "development"
4 changes: 2 additions & 2 deletions config/test.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Config

config :jellyfish_server_sdk,
server_address: "jellyfish:5002",
config :fishjam_server_sdk,
server_address: "fishjam:5002",
server_api_token: "development",
webhook_address: "test"
2 changes: 1 addition & 1 deletion config/test_local.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Config

config :jellyfish_server_sdk,
config :fishjam_server_sdk,
server_address: "127.0.0.1:5002",
server_api_token: "development",
webhook_address: "127.0.0.1"
26 changes: 12 additions & 14 deletions docker-compose-dev.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
version: "3"

services:
jellyfish:
image: "ghcr.io/fishjam-dev/jellyfish:${TAG:-edge}"
container_name: jellyfish
fishjam:
image: "ghcr.io/fishjam-dev/fishjam:${TAG:-edge}"
container_name: fishjam
restart: on-failure
healthcheck:
test: >
Expand All @@ -13,15 +11,15 @@ services:
timeout: 2s
start_period: 30s
environment:
JF_HOST: "localhost:5002"
JF_INTEGRATED_TURN_IP: "${INTEGRATED_TURN_IP:-127.0.0.1}"
JF_INTEGRATED_TURN_LISTEN_IP: "0.0.0.0"
JF_INTEGRATED_TURN_PORT_RANGE: "50000-50050"
JF_INTEGRATED_TCP_TURN_PORT: "49999"
JF_SERVER_API_TOKEN: "development"
JF_SIP_USED: "true"
JF_SIP_IP: "127.0.0.1"
JF_PORT: 5002
FJ_HOST: "localhost:5002"
FJ_PORT: 5002
FJ_SERVER_API_TOKEN: "development"
FJ_COMPONENTS_USED: "file hls rtsp sip recording"
FJ_WEBRTC_TURN_IP: "${INTEGRATED_TURN_IP:-127.0.0.1}"
FJ_WEBRTC_TURN_LISTEN_IP: "0.0.0.0"
FJ_WEBRTC_TURN_PORT_RANGE: "50000-50050"
FJ_WEBRTC_TURN_TCP_PORT: "49999"
FJ_SIP_IP: "127.0.0.1"
ports:
- "5002:5002"
- "49999:49999"
Expand Down
12 changes: 5 additions & 7 deletions docker-compose-test.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3"

services:
test:
image: membraneframeworklabs/docker_membrane:v2.2.0
Expand All @@ -11,14 +9,14 @@ services:
ports:
- "4000:4000"
depends_on:
jellyfish:
fishjam:
condition: service_healthy

jellyfish:
fishjam:
extends:
file: docker-compose-dev.yaml
service: jellyfish
service: fishjam
environment:
- JF_HOST=jellyfish:5002
- FJ_HOST=fishjam:5002
volumes:
- ./test/fixtures:/app/jellyfish_resources/file_component_sources
- ./test/fixtures:/app/fishjam_resources/file_component_sources
10 changes: 5 additions & 5 deletions examples/server_socket.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Mix.install(
[
{:jellyfish_server_sdk, path: __DIR__ |> Path.join("..") |> Path.expand()}
{:fishjam_server_sdk, path: __DIR__ |> Path.join("..") |> Path.expand()}
],
force: true
)
Expand All @@ -9,14 +9,14 @@ server_address = "localhost:5002"
server_api_token = "development"

{:ok, notifier} =
Jellyfish.WSNotifier.start(server_address: server_address, server_api_token: server_api_token)
Fishjam.WSNotifier.start(server_address: server_address, server_api_token: server_api_token)

{:ok, _rooms} = Jellyfish.WSNotifier.subscribe_server_notifications(notifier, :all)
:ok = Jellyfish.WSNotifier.subscribe_metrics(notifier)
{:ok, _rooms} = Fishjam.WSNotifier.subscribe_server_notifications(notifier, :all)
:ok = Fishjam.WSNotifier.subscribe_metrics(notifier)

receive_notification = fn receive_notification ->
receive do
{:jellyfish, event} ->
{:fishjam, event} ->
IO.inspect(event, label: :event)
after
150_000 ->
Expand Down
30 changes: 15 additions & 15 deletions lib/jellyfish/client.ex
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
defmodule Jellyfish.Client do
defmodule Fishjam.Client do
@moduledoc """
Defines a `t:Jellyfish.Client.t/0`.
Defines a `t:Fishjam.Client.t/0`.
By default, Mint adapter for [Tesla](https://github.com/elixir-tesla/tesla) is used to make HTTP requests, but it can be changed:
```
# config.exs
config :jellyfish_server_sdk, tesla_adapter: Tesla.Adapter.Hackney
config :fishjam_server_sdk, tesla_adapter: Tesla.Adapter.Hackney
# mix.exs
defp deps do
Expand All @@ -17,7 +17,7 @@ defmodule Jellyfish.Client do
For the list of supported Tesla adapters refer to [Tesla docs](https://hexdocs.pm/tesla/readme.html#adapters).
"""

alias Jellyfish.Utils
alias Fishjam.Utils

@enforce_keys [
:http_client
Expand All @@ -29,19 +29,19 @@ defmodule Jellyfish.Client do
}

@typedoc """
Options needed to open connection to Jellyfish server.
Options needed to open connection to Fishjam server.
* `:server_address` - address of the Jellyfish server instance.
* `:server_address` - address of the Fishjam server instance.
* `:server_api_token` - token used for authorizing HTTP requests and WebSocket connection.
It's the same token as the one configured in Jellyfish.
It's the same token as the one configured in Fishjam.
* `:secure?` - if `true`, use HTTPS and WSS instead of HTTP and WS, `false` by default.
When an option is not explicily passed, value set in `config.exs` is used:
```
# in config.exs
config :jellyfish_server_sdk,
config :fishjam_server_sdk,
server_address: "localhost:5002",
server_api_token: "your-jellyfish-token",
server_api_token: "your-fishjam-token",
secure?: true
```
"""
Expand All @@ -52,15 +52,15 @@ defmodule Jellyfish.Client do
]

@doc """
Creates a new instance of `t:Jellyfish.Client.t/0`.
Creates a new instance of `t:Fishjam.Client.t/0`.
For information about options, see `t:connection_options/0`.
"""
@spec new(connection_options()) :: t()
def new(opts \\ []) do
{address, api_token, secure?} = Utils.get_options_or_defaults(opts)
address = if secure?, do: "https://#{address}", else: "http://#{address}"
adapter = Application.get_env(:jellyfish_server_sdk, :tesla_adapter, Tesla.Adapter.Mint)
adapter = Application.get_env(:fishjam_server_sdk, :tesla_adapter, Tesla.Adapter.Mint)

middleware = [
{Tesla.Middleware.BaseUrl, address},
Expand All @@ -74,11 +74,11 @@ defmodule Jellyfish.Client do
end

@doc """
Updates Jellyfish address.
Updates Fishjam address.
When running Jellyfish in a cluster, user has to
manually update Jellyfish address after creating a room.
See also `Jellyfish.Room.create/2`.
When running Fishjam in a cluster, user has to
manually update Fishjam address after creating a room.
See also `Fishjam.Room.create/2`.
"""
@spec update_address(t(), String.t()) :: t()
def update_address(client, new_address) do
Expand Down
12 changes: 6 additions & 6 deletions lib/jellyfish/component.ex
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
defmodule Jellyfish.Component do
defmodule Fishjam.Component do
@moduledoc """
Defines `t:Jellyfish.Component.t/0`.
Defines `t:Fishjam.Component.t/0`.
Component is a server-side entity that can publish, subscribe to and process tracks.
For more information refer to [Jellyfish documentation](https://jellyfish-dev.github.io/jellyfish-docs/introduction/basic_concepts).
For more information refer to [Fishjam documentation](https://fishjam-dev.github.io/fishjam-docs/introduction/basic_concepts).
"""

alias Jellyfish.Component.{File, HLS, Recording, RTSP, SIP}
alias Jellyfish.Exception.StructureError
alias Jellyfish.Track
alias Fishjam.Component.{File, HLS, Recording, RTSP, SIP}
alias Fishjam.Exception.StructureError
alias Fishjam.Track

@enforce_keys [
:id,
Expand Down
2 changes: 1 addition & 1 deletion lib/jellyfish/component/deserializer.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defmodule Jellyfish.Component.Deserializer do
defmodule Fishjam.Component.Deserializer do
@moduledoc false
@callback properties_from_json(map()) :: map()
end
8 changes: 4 additions & 4 deletions lib/jellyfish/component/file.ex
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
defmodule Jellyfish.Component.File do
defmodule Fishjam.Component.File do
@moduledoc """
Options for the File component.
For the description of these options refer to [Jellyfish
documentation](https://jellyfish-dev.github.io/jellyfish-docs/getting_started/components/file).
For the description of these options refer to [Fishjam
documentation](https://fishjam-dev.github.io/fishjam-docs/getting_started/components/file).
"""

@behaviour Jellyfish.Component.Deserializer
@behaviour Fishjam.Component.Deserializer

@enforce_keys [:file_path]
defstruct @enforce_keys ++ [framerate: nil]
Expand Down
8 changes: 4 additions & 4 deletions lib/jellyfish/component/hls.ex
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
defmodule Jellyfish.Component.HLS do
defmodule Fishjam.Component.HLS do
@moduledoc """
Options for the HLS component.
For the description of these options refer to [Jellyfish
documentation](https://jellyfish-dev.github.io/jellyfish-docs/getting_started/components/hls).
For the description of these options refer to [Fishjam
documentation](https://fishjam-dev.github.io/fishjam-docs/getting_started/components/hls).
"""

@behaviour Jellyfish.Component.Deserializer
@behaviour Fishjam.Component.Deserializer

@type credentials :: %{
access_key_id: String.t(),
Expand Down
10 changes: 5 additions & 5 deletions lib/jellyfish/component/recording.ex
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
defmodule Jellyfish.Component.Recording do
defmodule Fishjam.Component.Recording do
@moduledoc """
Options for the recording component.
For the description of these options refer to [Jellyfish
documentation](https://jellyfish-dev.github.io/jellyfish-docs/getting_started/components/recording).
For the description of these options refer to [Fishjam
documentation](https://fishjam-dev.github.io/fishjam-docs/getting_started/components/recording).
"""

@behaviour Jellyfish.Component.Deserializer
@behaviour Fishjam.Component.Deserializer

alias Jellyfish.Component.HLS
alias Fishjam.Component.HLS

@enforce_keys []
defstruct @enforce_keys ++ [credentials: nil, path_prefix: nil, subscribe_mode: :auto]
Expand Down
8 changes: 4 additions & 4 deletions lib/jellyfish/component/rtsp.ex
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
defmodule Jellyfish.Component.RTSP do
defmodule Fishjam.Component.RTSP do
@moduledoc """
Options for the RTSP component.
For the description of these options refer to [Jellyfish
documentation](https://jellyfish-dev.github.io/jellyfish-docs/getting_started/components/rtsp).
For the description of these options refer to [Fishjam
documentation](https://fishjam-dev.github.io/fishjam-docs/getting_started/components/rtsp).
"""

@behaviour Jellyfish.Component.Deserializer
@behaviour Fishjam.Component.Deserializer

@enforce_keys [:source_uri]
defstruct @enforce_keys ++
Expand Down
Loading

0 comments on commit ecd7971

Please sign in to comment.