README.md

# Late

Late is a websocket client library for Elixir using Mint and `:gen_statem`.

## Usage

```elixir
defmodule TestConnection do
  @behaviour Late

  require Logger

  @impl true
  def init(opts) do
    {:ok, 0}
  end

  def handle_connect(state) do
    Logger.info("connected")
    {:reply, {:text, "hi"}, state}
  end

  def handle_call({:send, msg}, from, state) do
    Late.reply(from, :ok_u_fool)
    {:reply, {:text, msg}, state}
  end

  def handle_call(:send, {:text, ssml}, from, state) do
    {:noreply, state}
  end

  def handle_call({:synthesize, ssml}, from, state) do
    {:noreply, state}
  end

  @impl true
  def handle_in({:text, "bye" <> _text}, state) do
    {:stop, state}
  end

  @impl true
  def handle_info(message, state) do
    Logger.info("Handle in 2 #{inspect(message)}")
    # {:reply, {:text, "yo"}, state}
    {:reply, [{:text, "mesage one"}, {:text, message}], state}
    # {:reply, {:text, message}, state}
  end
end

{:ok, pid} = Late.start_link(
  TestConnection,
  [],
  url: "ws://localhost:8888/websocket",
  debug: [:trace]
)
```

## Installation

```elixir
def deps do
  [
    {:late, "~> 0.1.0"}
  ]
end
```