macula_protocol_types (macula v0.14.3)
View SourceProtocol message type definitions and constants for Macula mesh. Defines all message types that can be sent over QUIC streams.
Summary
Types
-type message() :: {connect, connect_msg()} | {disconnect, disconnect_msg()} | {ping, ping_msg()} | {pong, pong_msg()} | {publish, publish_msg()} | {subscribe, subscribe_msg()} | {unsubscribe, unsubscribe_msg()} | {pubsub_route, pubsub_route_msg()} | {call, call_msg()} | {reply, reply_msg()} | {cast, cast_msg()} | {rpc_route, rpc_route_msg()}.
-type message_type() ::
connect | disconnect | ping | pong | publish | subscribe | unsubscribe | pubsub_route | call |
reply | cast | rpc_route | rpc_request | rpc_reply | swim_ping | swim_ack | swim_ping_req |
find_node | find_node_reply | store | find_value | find_value_reply | nat_probe |
nat_probe_reply | punch_request | punch_coordinate | punch_execute | punch_result |
relay_request | relay_data | bridge_rpc | bridge_data.
-type ping_msg() :: #{timestamp := integer()}.
-type subscribe_msg() :: #{topics := [binary()], qos := 0 | 1 | 2}.
-type unsubscribe_msg() :: #{topics := [binary()]}.
Functions
-spec message_type_id(message_type()) -> byte().
Get numeric ID for a message type.
-spec message_type_name(byte()) -> {ok, message_type()} | {error, unknown_type}.
Get message type name from numeric ID.