View Source Jellyfish.Client (Jellyfish Server SDK v0.5.1)

Defines a Jellyfish.Client.t/0.

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

# config.exs
config :jellyfish_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 Jellyfish server.

t()

Functions

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

Updates Jellyfish address.

Types

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

Options needed to open connection to Jellyfish server.

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

Functions

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

Creates a new instance of Jellyfish.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 Jellyfish address.

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