# `Portals.Transport`
[🔗](https://github.com/Ziinc/portals/blob/v0.1.0/lib/portals/transport.ex#L1)

Transport behaviour for moving framed bytes between the BEAM and a
worker. A transport does not know about frame contents; it only owns
byte delivery and must deliver received bytes as Erlang messages to the
owning process so a `Portals.Connection`-style GenServer can multiplex
transport I/O with call handling in its normal message loop.

`Portals.Transport.Unix` (default) and `Portals.Transport.Stdio`
(fallback, used automatically on platforms without Unix-domain socket
support) both implement this behaviour.

# `socket`

```elixir
@type socket() :: term()
```

# `accept`

```elixir
@callback accept(socket(), timeout()) :: {:ok, socket()} | {:error, term()}
```

Block (up to `timeout`) for the worker to connect.

# `close`

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

Stop delivering data to the caller and release transport resources.

# `listen`

```elixir
@callback listen(opts :: keyword()) :: {:ok, socket()} | {:error, term()}
```

Start listening for the worker's single incoming connection.

# `send`

```elixir
@callback send(socket(), iodata()) :: :ok | {:error, term()}
```

Send raw bytes.

---

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