On 12/25/2011 07:00 PM, Zvi wrote:
> Hi,
>
> I read the MQTT 3.1 spec and didn't found a way to send one-to-one
> messages.
It's been said before, this is pubsub, not direct messaging with support for
multicasting.
> The only way I see is to subscribe each client immediately after
> CONNECT to topic "client/<CLIENT-ID>".
Yep, that's pretty much exactly how we use it. But, although "<client-id>" is
the _intended_ recipient, it's just a topic. More people can listen in, see
what's being said, watch what's going on, graph which clients cause the most
requests, stats on ALLLL the things! If you don't want that, and you want
private encrypted channels, one to one, then a pub sub protocol is not really
what you're looking for.
Or, of course, you add that on top. There's nothing stopping you from public
key encrypting the message bodies, with HMAC signatures appended to the topic
for instance....
> Depending on the broker implementation, this can be expensive
> operation.
Sure, but that's not a protocol problem. That's like saying http is expensive
if the server is stupid. It's true, but so what?
Cheers,
Karl P
Maybe a "tips and tricks" or "messaging techniques" section would be useful...
> --
> To learn more about MQTT please visit http://mqtt.org
>
> To post to this group, send email to mq...@googlegroups.com
> To unsubscribe from this group, send email to
> mqtt+uns...@googlegroups.com
>
> For more options, visit this group at
> http://groups.google.com/group/mqtt
--
Andy Piper | Farnborough, Hampshire (UK)
blog: http://andypiper.co.uk | skype: andypiperuk
twitter: @andypiper | images: http://www.flickr.com/photos/andypiper
I think the point that Andy (and Nick, in another thread) made is that
one-to-one is essentially just an agreed topic pair between clients?
That's all it needs to be, doesn't it?
The convention used is:
publish to $SYS/client/<clientId>/<topic> (where <clientId> is the id
of the client you want to push to and <topic> is an optional extra
topic string)
The client will then receive the message even if it hasn't subscribed.
You can also publish to $SYS/all-clients to push a message to all
connected clients.
$SYS/ has always been considered a broker-specific topic space. In
RSMB, subscribing to # does not get you topics in the $SYS/ namespace,
you have to explicitly describe to $SYS/#. This is another one of
those unwritten conventions we have used over the years.
MQ also has the ability to push to a client if you put a message on a
queue with a specific name (can't remember the convention used there)
- but that's more a function of the MQTT support in MQ, rather than
that of a pure MQTT broker.
> From the point of view of broker implementer it's hard to implement
> scalable broker when you don't know if topic has only one subscriber
> or multiple subscribers.
I'd disagree with that, having worked on two separate broker
implementations (one in C and one in Java) - but it does depend on how
you've structured your subscription model.
Nick
Nick
> To learn more about MQTT please visit http://mqtt.org