Spell.Message

The Spell.Message module defines the struct and functions to back WAMP messages.

Note that these are distinct from Erlixir’s messages.

Source

Summary

get_code_for_type(type, default \\ nil)

Get the code for the message type

get_type_for_code(type, default \\ nil)

Get the message type for code

new!(options)

Returns a new message, or raises an exception

new(options)

Returns a new message

new_id()

Return a new WAMP id

Types

wamp_integer :: integer

wamp_bool :: boolean

new_error :: :type_code_missing | :type_code_mismatch | {:args, :not_list} | {:code, :out_of_range | :bad_value}

t :: %Spell.Message{type: type, code: integer, args: args}

Functions

get_code_for_type(type, default \\ nil)

Specs:

  • get_code_for_type(type, default) :: integer | nil | default when default: any

Get the code for the message type.

Source
get_type_for_code(type, default \\ nil)

Specs:

  • get_type_for_code(integer, default) :: type | nil | default when default: any

Get the message type for code.

Source
new(options)

Specs:

Returns a new message.

Options

There is a one to one mapping between type and code. Either type or code must be provided. If both are provided, they must be consistent.

  • type :: atom the name of the message type. If type isn’t provided, it is be set by get_type_for_integer(code).
  • code :: integer the integer code for the message type. If code isn’t isn’t provided it is set by get_integer_for_type(type). type must have a valid code.
  • args :: [wamp_type] defaults to [], the list of message arguments.
Source
new!(options)

Specs:

Returns a new message, or raises an exception.

Options

See new/1.

Source
new_id()

Specs:

  • new_id :: integer

Return a new WAMP id.

Source