View Source Fishjam.Client (Fishjam Server SDK v0.6.0)

Defines a Fishjam.Client.t/0.

By default, Mint adapter for Tesla is used to make HTTP requests, but it can be changed:

# config.exs
config :fishjam_server_sdk, tesla_adapter: Tesla.Adapter.Hackney

# mix.exs
defp deps do
  [
    {:hackney, "~> 1.10"}
  ]
end

For the list of supported Tesla adapters refer to Tesla docs.

Summary

Types

Options needed to open connection to Fishjam server.

t()

Functions

Creates a new instance of Fishjam.Client.t/0.

Updates Fishjam address.

Types

@type connection_options() :: [
  server_address: String.t(),
  server_api_token: String.t(),
  secure?: boolean()
]

Options needed to open connection to Fishjam server.

  • :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 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 :fishjam_server_sdk,
  server_address: "localhost:5002",
  server_api_token: "your-fishjam-token",
  secure?: true
@type t() :: %Fishjam.Client{http_client: Tesla.Client.t()}

Functions

@spec new(connection_options()) :: t()

Creates a new instance of Fishjam.Client.t/0.

For information about options, see connection_options/0.

Link to this function

update_address(client, new_address)

View Source
@spec update_address(t(), String.t()) :: t()

Updates Fishjam address.

When running Fishjam in a cluster, user has to manually update Fishjam address after creating a room. See also Fishjam.Room.create/2.