From d4176461ff6ae736e08a2efd0c466ef300d8d34c Mon Sep 17 00:00:00 2001 From: Petr Gotthard Date: Mon, 20 Aug 2018 11:58:19 +0200 Subject: [PATCH] Send client_pid to distinguish multiple clients When a controlling process starts multiple clients that make multiple subscriptions it may be desirable to identify from which client a message is comming from. The topic id may not be sufficient. --- src/emqx_client.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/emqx_client.erl b/src/emqx_client.erl index 695b9d10c..27f8be353 100644 --- a/src/emqx_client.erl +++ b/src/emqx_client.erl @@ -989,7 +989,8 @@ deliver(#mqtt_msg{qos = QoS, dup = Dup, retain = Retain, packet_id = PacketId, topic = Topic, props = Props, payload = Payload}, State = #state{owner = Owner}) -> Owner ! {publish, #{qos => QoS, dup => Dup, retain => Retain, packet_id => PacketId, - topic => Topic, properties => Props, payload => Payload}}, + topic => Topic, properties => Props, payload => Payload, + client_pid => self()}}, State. packet_to_msg(#mqtt_packet{header = #mqtt_packet_header{type = ?PUBLISH,