moquette-io / moquette

Java MQTT lightweight broker
http://moquette-io.github.io/moquette/
Apache License 2.0
2.27k stars 814 forks source link

internalPublish now can send to specific clientId #786

Closed maxwang789 closed 7 months ago

maxwang789 commented 8 months ago
  1. internalPublish now can send to specific client
  2. add config to generate unique ClientID for each client

The original request is that one request will be sent to topic "/request", but the response should be sent back on another topic "/response". With these modifications, the embedding broker could distinguish all connections.

Correct me if I'm wrong.

hylkevds commented 8 months ago

That seems to be a feature that inherently violates the MQTT spec. Every client that has a subscription to a given Topic must get every (QoS dependent) message sent to this Topic.

The MQTT 5 spec adds a request/response mechanism that explains how to send a message to a specific client, by negotiating a private Topic for this client.

maxwang789 commented 8 months ago

That seems to be a feature that inherently violates the MQTT spec. Every client that has a subscription to a given Topic must get every (QoS dependent) message sent to this Topic.

The MQTT 5 spec adds a request/response mechanism that explains how to send a message to a specific client, by negotiating a private Topic for this client.

Yes, MQTT v5 add new mechanism. But it needs publisher and subscriber support new fields and new behaviors. Sometime old equipment just uses MQTT as transport layer, it won't upgrade to MQTTv5.

And this modification is intended to be used in embedded server only, it won't change mqtt protocol or other behavior outside broker.