View Source FLHook.Client (FLHook Client v1.0.0)

A GenServer that connects to a FLHook socket.

Link to this section Summary

Types

Type representing a FLHook client process.

Functions

The child specification for a FLHook client.

Closes the connection.

Sends a command to the socket and returns the result.

Sends a command to the socket and returns the result. Raises on error.

Indicates whether the socket is connected.

Opens the connection.

Starts the FLHook client using the given config or options.

Starts the FLHook client using the given config and options.

Registers the specified process as event listener.

Removes the event listener for the specified process.

Link to this section Types

Specs

client() :: GenServer.server()

Type representing a FLHook client process.

Link to this section Functions

Specs

child_spec(term()) :: Supervisor.child_spec()

The child specification for a FLHook client.

Specs

close(client()) :: :ok

Closes the connection.

Specs

cmd(client(), FLHook.command()) ::
  {:ok, FLHook.Result.t()} | {:error, Exception.t()}

Sends a command to the socket and returns the result.

Specs

Sends a command to the socket and returns the result. Raises on error.

Specs

connected?(client()) :: boolean()

Indicates whether the socket is connected.

Specs

open(client()) :: :ok | {:error, Exception.t()}

Opens the connection.

Specs

Starts the FLHook client using the given config or options.

Link to this function

start_link(config, opts)

View Source

Specs

Starts the FLHook client using the given config and options.

Link to this function

subscribe(client, listener \\ self())

View Source

Specs

subscribe(client(), GenServer.server()) :: :ok

Registers the specified process as event listener.

Link to this function

unsubscribe(client, listener \\ self())

View Source

Specs

unsubscribe(client(), GenServer.server()) :: :ok

Removes the event listener for the specified process.