message published on a topic before subscriber subscribe to a topic

94 views
Skip to first unread message

bhashkar prakash singh

unread,
Feb 12, 2014, 12:18:02 AM2/12/14
to mq...@googlegroups.com
Hi,

I am very new to MQTT. need some help on it.
I am having this scenario:

1)      First Publisher publish on topic A. Then Subscriber subscribe on topic A. Will subscriber gets notification for topic A, published before subscription?  If yes, how many such notifications are preserved for the subscriber coming up later? Also is it possible that a message is published before subscriber is subscribed and message  is delivered to  subscriber when it is subscribed?                                                                                                                                                                                                                                                         Thanks in Advance.                                                                                                                                                                                                                                                 Regards, Bhashkar




2)            

3)   

Nicholas O'Leary

unread,
Feb 12, 2014, 7:09:30 AM2/12/14
to mq...@googlegroups.com
Hi,

In general, a client that subscribes to a topic will not receive messages already published to the topic.

There are two exceptions to this:

1. If a client connects with cleanSession=false, subscribes and then disconnects, when it reconnects (again cleanSession=false and the same client id) it will receive messages that were published whilst to was not connected.

2. A message can be published with the retained flag set. When a client subscribes to the topic, it will receive the most recent retained message on that topic (you cannot have multiple retained messages in a single topic... Only the most recent one is stored)

Regards,
Nick
--
To learn more about MQTT please visit http://mqtt.org
---
You received this message because you are subscribed to the Google Groups "MQ Telemetry Transport" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mqtt+uns...@googlegroups.com.
To post to this group, send email to mq...@googlegroups.com.
Visit this group at http://groups.google.com/group/mqtt.
For more options, visit https://groups.google.com/groups/opt_out.

bhashkar prakash singh

unread,
Feb 13, 2014, 4:13:14 AM2/13/14
to mq...@googlegroups.com
Hi,

Thanks  Nick for your quick response.

Regards,
Bhashkar
To unsubscribe from this group and stop receiving emails from it, send an email to mqtt+unsubscribe@googlegroups.com.

张斌

unread,
Feb 27, 2014, 10:52:07 AM2/27/14
to mq...@googlegroups.com

1. If a client connects with cleanSession=false, subscribes and then disconnects, when it reconnects (again cleanSession=false and the same client id) it will receive messages that were published whilst to was not connected.

For this case, i think only for QoS 1 & QoS 2 messages 
Reply all
Reply to author
Forward
0 new messages