0.16 - support static subscriptions

This commit is contained in:
Feng 2016-02-02 13:36:52 +08:00
parent 5306463b7e
commit 1e852ded91
2 changed files with 18 additions and 15 deletions

View File

@ -1,5 +1,5 @@
%%%----------------------------------------------------------------------------- %%%-----------------------------------------------------------------------------
%%% Copyright (c) 2012-2016 eMQTT.IO, All Rights Reserved. %%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>. All Rights Reserved.
%%% %%%
%%% Permission is hereby granted, free of charge, to any person obtaining a copy %%% Permission is hereby granted, free of charge, to any person obtaining a copy
%%% of this software and associated documentation files (the "Software"), to deal %%% of this software and associated documentation files (the "Software"), to deal
@ -63,9 +63,10 @@
%% MQTT Subscription %% MQTT Subscription
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
-record(mqtt_subscription, { -record(mqtt_subscription, {
subid :: binary() | atom(), subid :: binary() | atom(),
topic :: binary(), topic :: binary(),
qos = 0 :: 0 | 1 | 2 qos = 0 :: 0 | 1 | 2,
static = false :: boolean()
}). }).
-type mqtt_subscription() :: #mqtt_subscription{}. -type mqtt_subscription() :: #mqtt_subscription{}.
@ -110,16 +111,18 @@
-type mqtt_pktid() :: 1..16#ffff | undefined. -type mqtt_pktid() :: 1..16#ffff | undefined.
-record(mqtt_message, { -record(mqtt_message, {
msgid :: mqtt_msgid(), %% Global unique message ID msgid :: mqtt_msgid(), %% Global unique message ID
pktid :: mqtt_pktid(), %% PacketId pktid :: mqtt_pktid(), %% PacketId
topic :: binary(), %% Topic that the message is published to topic :: binary(), %% Topic that the message is published to
from :: binary() | atom(), %% ClientId of publisher from :: binary() | atom(), %% ClientId of the publisher
qos = 0 :: 0 | 1 | 2, %% Message QoS sender :: binary() | undefined, %% Username of the publisher
retain = false :: boolean(), %% Retain flag qos = 0 :: 0 | 1 | 2, %% Message QoS
dup = false :: boolean(), %% Dup flag flags = [] :: [retain | dup | sys], %% Message Flags
sys = false :: boolean(), %% $SYS flag retain = false :: boolean(), %% Retain flag
payload :: binary(), %% Payload dup = false :: boolean(), %% Dup flag
timestamp :: erlang:timestamp() %% os:timestamp sys = false :: boolean(), %% $SYS flag
payload :: binary(), %% Payload
timestamp :: erlang:timestamp() %% os:timestamp
}). }).
-type mqtt_message() :: #mqtt_message{}. -type mqtt_message() :: #mqtt_message{}.

View File

@ -1,5 +1,5 @@
%%%----------------------------------------------------------------------------- %%%-----------------------------------------------------------------------------
%%% Copyright (c) 2012-2016 eMQTT.IO, All Rights Reserved. %%% Copyright (c) 2012-2016 Feng Lee <feng@emqtt.io>. All Rights Reserved.
%%% %%%
%%% Permission is hereby granted, free of charge, to any person obtaining a copy %%% Permission is hereby granted, free of charge, to any person obtaining a copy
%%% of this software and associated documentation files (the "Software"), to deal %%% of this software and associated documentation files (the "Software"), to deal