Fix issue #916 - add 'mqtt_msg_from()' type

This commit is contained in:
Feng Lee 2017-02-22 14:11:10 +08:00
parent f4c4e5635c
commit 088adeda3b
1 changed files with 5 additions and 2 deletions

View File

@ -108,13 +108,15 @@
-type(mqtt_pktid() :: 1..16#ffff | undefined). -type(mqtt_pktid() :: 1..16#ffff | undefined).
-type(mqtt_msg_from() :: atom() | {binary(), undefined | binary()}).
-record(mqtt_message, -record(mqtt_message,
{ %% Global unique message ID { %% Global unique message ID
id :: mqtt_msgid(), id :: mqtt_msgid(),
%% PacketId %% PacketId
pktid :: mqtt_pktid(), pktid :: mqtt_pktid(),
%% ClientId and Username %% ClientId and Username
from :: {binary(), undefined | binary()}, from :: mqtt_msg_from(),
%% Topic that the message is published to %% Topic that the message is published to
topic :: binary(), topic :: binary(),
%% Message QoS %% Message QoS
@ -127,12 +129,13 @@
dup = false :: boolean(), dup = false :: boolean(),
%% $SYS flag %% $SYS flag
sys = false :: boolean(), sys = false :: boolean(),
%% Headers
headers = [] :: list(), headers = [] :: list(),
%% Payload %% Payload
payload :: binary(), payload :: binary(),
%% Timestamp %% Timestamp
timestamp :: erlang:timestamp() timestamp :: erlang:timestamp()
}). }).
-type(mqtt_message() :: #mqtt_message{}). -type(mqtt_message() :: #mqtt_message{}).