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.
This commit is contained in:
Petr Gotthard 2018-08-20 11:58:19 +02:00
parent 22e8b07a3d
commit d4176461ff
1 changed files with 2 additions and 1 deletions

View File

@ -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,