Search documentation of grizzly

# View Source Grizzly.Transport behaviour (grizzly v7.4.2)

Behaviour and functions for communicating to `zipgateway`

# Summary

## Types

args()
listen_option()

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.

parse_opt()
socket()
t()

## Callbacks

accept(t)
close(t)
handshake(t)
listen(t)
open(keyword)
parse_response(any, list)
peername(t)
send(t, binary, keyword)

## Functions

accept(transport)

Accept a new connection

assign(transport, assign, default \\ nil)

Get the assign value for the field

assigns(transport, assign, assign_value)

Update the assigns with this field and value

handshake(transport)

Preform the handshake

listen(transport)

Listen using a transport

new(impl, assigns \\ %{})

Make a new `Grizzly.Transport`

node_id(transport)
open(transport_module, args)

Open the transport

parse_response(transport, response, opts \\ [])

Parse the response for the transport

peername(transport)
send(transport, binary, opts \\ [])

Send binary data using a transport

# Types

Link to this type

# args()

View Source

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

Link to this type

# listen_option()

View Source

    @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.

Link to this type

# parse_opt()

View Source

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

Link to this type

# socket()

View Source

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

Link to this opaque

# t()

View Source

    @opaque t()

# Callbacks

Link to this callback

# accept(t)

View Source

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

Link to this callback

# close(t)

View Source

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

Link to this callback

# handshake(t)

View Source

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

Link to this callback

# listen(t)

View Source

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

Link to this callback

# open(keyword)

View Source

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

Link to this callback

# parse_response(any, list)

View Source

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

Link to this callback

# peername(t)

View Source

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

Link to this callback

# send(t, binary, keyword)

View Source

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

# Functions

Link to this function

# accept(transport)

View Source

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

Accept a new connection

Link to this function

# assign(transport, assign, default \\ nil)

View Source

    @spec assign(t(), atom(), any()) :: any()

Get the assign value for the field

Link to this function

# assigns(transport, assign, assign_value)

View Source

    @spec assigns(t(), atom(), any()) :: t()

Update the assigns with this field and value

Link to this function

# handshake(transport)

View Source

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

Preform the handshake

Link to this function

# listen(transport)

View Source

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

Listen using a transport

Link to this function

# new(impl, assigns \\ %{})

View Source

    @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.

Link to this function

# node_id(transport)

View Source

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

Link to this function

# open(transport_module, args)

View Source

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

Open the transport

Link to this function

# parse_response(transport, response, opts \\ [])

View Source

Parse the response for the transport

Link to this function

# peername(transport)

View Source

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

Link to this function

# send(transport, binary, opts \\ [])

View Source

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

Send binary data using a transport