# `WardrikSlack.Socket`

Connects to Slack over Socket Mode with the channel's `:app_token`. Needs no public address.

For testing. Slack expects apps in use to take events over HTTP. See `WardrikSlack.HTTP`.

  * Each envelope is handed to `WardrikSlack.Dispatch` in a task.
  * Messages are acknowledged after they're handled, so Slack resends one lost to a crash. Other
    envelopes are acknowledged at once.
  * When the connection closes, as Slack does every few hours, it reconnects. Backoff doubles
    from one second after each failure, up to a minute.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `envelope`

```elixir
@spec envelope(String.t()) ::
  :hello
  | :disconnect
  | {:ack, String.t(), {:interactive, map()} | {:event, map()} | :ignore}
  | {:ack_after, String.t(), {:message, map()}}
  | :ignore
```

Parses a text frame from Slack.

Returns `:hello`, `:disconnect`, `{:ack, id, work}` to acknowledge now,
`{:ack_after, id, {:message, callback}}` to acknowledge once handled, or `:ignore`.

# `start_link`

```elixir
@spec start_link(WardrikChannel.Channel.t()) :: GenServer.on_start()
```

Starts the connection for `channel`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
