From 1e852ded91701ab567b36daea1b9b65109c1064a Mon Sep 17 00:00:00 2001 From: Feng Date: Tue, 2 Feb 2016 13:36:52 +0800 Subject: [PATCH] 0.16 - support static subscriptions --- include/emqttd.hrl | 31 +++++++++++++++++-------------- src/emqttd.erl | 2 +- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/include/emqttd.hrl b/include/emqttd.hrl index 1163bc323..803be1318 100644 --- a/include/emqttd.hrl +++ b/include/emqttd.hrl @@ -1,5 +1,5 @@ %%%----------------------------------------------------------------------------- -%%% Copyright (c) 2012-2016 eMQTT.IO, All Rights Reserved. +%%% Copyright (c) 2012-2016 Feng Lee . All Rights Reserved. %%% %%% Permission is hereby granted, free of charge, to any person obtaining a copy %%% of this software and associated documentation files (the "Software"), to deal @@ -63,9 +63,10 @@ %% MQTT Subscription %%------------------------------------------------------------------------------ -record(mqtt_subscription, { - subid :: binary() | atom(), - topic :: binary(), - qos = 0 :: 0 | 1 | 2 + subid :: binary() | atom(), + topic :: binary(), + qos = 0 :: 0 | 1 | 2, + static = false :: boolean() }). -type mqtt_subscription() :: #mqtt_subscription{}. @@ -110,16 +111,18 @@ -type mqtt_pktid() :: 1..16#ffff | undefined. -record(mqtt_message, { - msgid :: mqtt_msgid(), %% Global unique message ID - pktid :: mqtt_pktid(), %% PacketId - topic :: binary(), %% Topic that the message is published to - from :: binary() | atom(), %% ClientId of publisher - qos = 0 :: 0 | 1 | 2, %% Message QoS - retain = false :: boolean(), %% Retain flag - dup = false :: boolean(), %% Dup flag - sys = false :: boolean(), %% $SYS flag - payload :: binary(), %% Payload - timestamp :: erlang:timestamp() %% os:timestamp + msgid :: mqtt_msgid(), %% Global unique message ID + pktid :: mqtt_pktid(), %% PacketId + topic :: binary(), %% Topic that the message is published to + from :: binary() | atom(), %% ClientId of the publisher + sender :: binary() | undefined, %% Username of the publisher + qos = 0 :: 0 | 1 | 2, %% Message QoS + flags = [] :: [retain | dup | sys], %% Message Flags + retain = false :: boolean(), %% Retain flag + dup = false :: boolean(), %% Dup flag + sys = false :: boolean(), %% $SYS flag + payload :: binary(), %% Payload + timestamp :: erlang:timestamp() %% os:timestamp }). -type mqtt_message() :: #mqtt_message{}. diff --git a/src/emqttd.erl b/src/emqttd.erl index 4e9bd42d7..47686544e 100644 --- a/src/emqttd.erl +++ b/src/emqttd.erl @@ -1,5 +1,5 @@ %%%----------------------------------------------------------------------------- -%%% Copyright (c) 2012-2016 eMQTT.IO, All Rights Reserved. +%%% Copyright (c) 2012-2016 Feng Lee . All Rights Reserved. %%% %%% Permission is hereby granted, free of charge, to any person obtaining a copy %%% of this software and associated documentation files (the "Software"), to deal