# `Grizzly.Transport`
[🔗](https://github.com/smartrent/grizzly/blob/v9.1.4/lib/grizzly/transport.ex#L1)

Behaviour and functions for communicating to `zipgateway`

# `args`

```elixir
@type args() :: [
  ip_address: :inet.ip_address(),
  port: :inet.port_number(),
  node_id: Grizzly.node_id(),
  transport: t()
]
```

# `listen_option`

```elixir
@type listen_option() :: {:strategy, :none | :accept}
```

After starting a server options can be passed back to the caller so that the
caller can do any other work it might seem fit.

Options:

  * - `:strategy` - this informs the caller if the transport needs to wait for
      connects to accept or if the socket can just process incoming messages.
      If the strategy is `:accept` that is to mean the socket is okay to start
      accepting new connections.

# `parse_opt`

```elixir
@type parse_opt() :: {:raw, boolean()}
```

# `socket`

```elixir
@type socket() :: :ssl.sslsocket() | :inet.socket()
```

# `t`

```elixir
@opaque t()
```

# `accept`

```elixir
@callback accept(t()) :: {:ok, t()} | {:error, any()}
```

# `close`

```elixir
@callback close(t()) :: :ok
```

# `handshake`

```elixir
@callback handshake(t()) :: {:ok, t()} | {:error, any()}
```

# `listen`

```elixir
@callback listen(t()) :: {:ok, t(), [listen_option()]} | {:error, any()}
```

# `open`

```elixir
@callback open(keyword()) :: {:ok, t()} | {:error, :timeout}
```

# `parse_response`

```elixir
@callback parse_response(any(), [parse_opt()]) ::
  {:ok, Grizzly.ZWave.Command.t() | binary() | :connection_closed}
  | {:error, Grizzly.ZWave.DecodeError.t()}
```

# `peername`

```elixir
@callback peername(t()) ::
  {:ok, {:inet.ip_address(), :inet.port_number()}} | {:error, any()}
```

# `send`

```elixir
@callback send(t(), binary(), keyword()) :: :ok
```

# `accept`

```elixir
@spec accept(t()) :: {:ok, t()} | {:error, any()}
```

Accept a new connection

# `get`

```elixir
@spec get(t(), atom(), any()) :: any()
```

Get the assign value for the field

# `handshake`

```elixir
@spec handshake(t()) :: {:ok, t()} | {:error, any()}
```

Preform the handshake

# `listen`

```elixir
@spec listen(t()) :: {:ok, t(), [listen_option()]} | {:error, any()}
```

Listen using a transport

# `new`

```elixir
@spec new(module(), map()) :: t()
```

Make a new `Grizzly.Transport`

If need to optionally assign some priv data you can map that into this function.

# `node_id`

```elixir
@spec node_id(t()) :: {:ok, Grizzly.node_id()} | {:error, any()}
```

# `open`

```elixir
@spec open(module(), args()) :: {:ok, t()} | {:error, :timeout}
```

Open the transport

# `parse_response`

Parse the response for the transport

# `peername`

```elixir
@spec peername(t()) ::
  {:ok, {:inet.ip_address(), :inet.port_number()}} | {:error, any()}
```

# `put`

```elixir
@spec put(t(), atom(), any()) :: t()
```

Update the assigns with this field and value

# `send`

```elixir
@spec send(t(), binary(), keyword()) :: :ok
```

Send binary data using a transport

---

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