SonicClient.TcpConnection (sonic_client v0.1.0) View Source

This is the TcpConnection module, responsible to send and receive calls.

Link to this section Summary

Functions

Starts connection with the Sonic server as a child process.

Sends a synchronous request with command command to the Sonic server through the PID child.

Link to this section Functions

Link to this function

open(host, port, opts \\ [], timeout \\ 5000)

View Source

Specs

open(String.t(), integer(), list(), integer()) :: {:error, any()} | {:ok, pid()}

Starts connection with the Sonic server as a child process.

Returns {:ok, conn}.

Where conn is the PID of the client.

Examples

SonicClient.TcpConnection.open(127.0.0.1, 1491, [])
{:ok, #PID<0.198.0>}

Specs

request(pid(), String.t()) :: {:ok, String.t()} | {:error, any()}

Sends a synchronous request with command command to the Sonic server through the PID child.

Returns {:ok, response}.

Where response is a String with the body of the response.

Link to this function

search_request(conn, command)

View Source