View Source AntikytheraCore.Handler.WebsocketState (antikythera v0.5.1)

Summary

Functions

Type-aware getter for conn.

Type-aware setter for conn.

Type-aware getter for error_reason.

Type-aware setter for error_reason.

Type-aware getter for frames_received.

Type-aware setter for frames_received.

Type-aware getter for frames_sent.

Type-aware setter for frames_sent.

Type-aware getter for gear_impl_state.

Type-aware setter for gear_impl_state.

Type-aware getter for helper_modules.

Type-aware setter for helper_modules.

Creates a new instance of AntikytheraCore.Handler.WebsocketState by using the given dict.

A variant of new/1 which returns t or raise if validation fails.

Updates an existing instance of AntikytheraCore.Handler.WebsocketState with the given dict. The values in the dict are validated by each field's valid?/1 function. Returns {:ok, valid_struct} or {:error, reason}.

A variant of update/2 which returns t or raise if validation fails. In other words, update/2 followed by Croma.Result.get!/1.

Checks if the given value belongs to t/0 or not.

Type-aware getter for ws_module.

Type-aware setter for ws_module.

Types

@type callback_result() ::
  {:ok, t()} | {:reply, Antikythera.Websocket.FrameList.t(), t()}
Link to this type

cowboy_ws_terminate_reason()

View Source
@type cowboy_ws_terminate_reason() ::
  :normal
  | :stop
  | :timeout
  | :remote
  | {:remote, :cow_ws.close_code(), binary()}
  | {:error, :badencoding | :badframe | :closed | atom()}
  | {:crash, :error | :exit | :throw, any()}
@type t() :: %AntikytheraCore.Handler.WebsocketState{
  conn: Antikythera.Conn.t(),
  error_reason: Croma.TypeGen.Nilable.Antikythera.ErrorReason.t(),
  frames_received: Croma.NonNegInteger.t(),
  frames_sent: Croma.NonNegInteger.t(),
  gear_impl_state: Croma.Any.t(),
  helper_modules: AntikytheraCore.Handler.HelperModules.t(),
  ws_module: Croma.Atom.t()
}

Functions

@spec conn(t()) :: Antikythera.Conn.t()

Type-aware getter for conn.

@spec conn(t(), Antikythera.Conn.t()) :: t()

Type-aware setter for conn.

Link to this function

error_reason(websocket_state)

View Source
@spec error_reason(t()) :: Croma.TypeGen.Nilable.Antikythera.ErrorReason.t()

Type-aware getter for error_reason.

@spec error_reason(t(), Croma.TypeGen.Nilable.Antikythera.ErrorReason.t()) :: t()

Type-aware setter for error_reason.

Link to this function

frames_received(websocket_state)

View Source
@spec frames_received(t()) :: Croma.NonNegInteger.t()

Type-aware getter for frames_received.

Link to this function

frames_received(s, field)

View Source
@spec frames_received(t(), Croma.NonNegInteger.t()) :: t()

Type-aware setter for frames_received.

Link to this function

frames_sent(websocket_state)

View Source
@spec frames_sent(t()) :: Croma.NonNegInteger.t()

Type-aware getter for frames_sent.

@spec frames_sent(t(), Croma.NonNegInteger.t()) :: t()

Type-aware setter for frames_sent.

Link to this function

gear_impl_state(websocket_state)

View Source
@spec gear_impl_state(t()) :: Croma.Any.t()

Type-aware getter for gear_impl_state.

Link to this function

gear_impl_state(s, field)

View Source
@spec gear_impl_state(t(), Croma.Any.t()) :: t()

Type-aware setter for gear_impl_state.

Link to this function

handle_client_message(state, frame)

View Source
@spec handle_client_message(
  t(),
  Antikythera.Websocket.Frame.t()
) :: callback_result()
Link to this function

handle_server_message(state, message)

View Source
@spec handle_server_message(
  t(),
  any()
) :: callback_result()
Link to this function

helper_modules(websocket_state)

View Source
@spec helper_modules(t()) :: AntikytheraCore.Handler.HelperModules.t()

Type-aware getter for helper_modules.

Link to this function

helper_modules(s, field)

View Source
@spec helper_modules(t(), AntikytheraCore.Handler.HelperModules.t()) :: t()

Type-aware setter for helper_modules.

@spec init(t()) :: callback_result()
Link to this function

make(conn, arg1, helper_modules)

View Source
@spec new(term()) :: Croma.Result.t(t())

Creates a new instance of AntikytheraCore.Handler.WebsocketState by using the given dict.

Returns {:ok, valid_struct} or {:error, reason}.

The values in the dict are validated by each field's valid?/1 function. If the value was invalid, it will be passed to new/1 of the field

For missing fields, followings will be tried:

  • default/0 of each field type
  • new/1 of each field type, with empty map as input
@spec new!(term()) :: t()

A variant of new/1 which returns t or raise if validation fails.

In other words, new/1 followed by Croma.Result.get!/1.

Link to this function

terminate(state, cowboy_terminate_reason)

View Source
@spec terminate(
  t(),
  cowboy_ws_terminate_reason()
) :: any()
@spec update(t(), Dict.t()) :: Croma.Result.t(t())

Updates an existing instance of AntikytheraCore.Handler.WebsocketState with the given dict. The values in the dict are validated by each field's valid?/1 function. Returns {:ok, valid_struct} or {:error, reason}.

@spec update!(t(), Dict.t()) :: t()

A variant of update/2 which returns t or raise if validation fails. In other words, update/2 followed by Croma.Result.get!/1.

@spec valid?(term()) :: boolean()

Checks if the given value belongs to t/0 or not.

Link to this function

ws_module(websocket_state)

View Source
@spec ws_module(t()) :: Croma.Atom.t()

Type-aware getter for ws_module.

@spec ws_module(t(), Croma.Atom.t()) :: t()

Type-aware setter for ws_module.