Regarding clean sessions

25 views
Skip to first unread message

Chaitanya Munukutla

unread,
Dec 24, 2020, 12:54:40 PM12/24/20
to MQTT
Hi,

I'm implementing an MQTT v5 compatible broker and I think I'm a bit stuck at the stateless / persistent sessions concept.

  1. When the CONNECT packet is sent to broker and cleanSession is set to true, should the broker clear sessions stored elsewhere for the same clientID? 
  2. There is a sessionExists flag on the CONNACK header. In case a client already has a persistent stored on the broker (which gets disconnected for whatever reasons) and later connects asking for a clean session, should the broker invalidate the earlier stored session, create a session without any state? If the broker has already invalidated the earlier sessions, should the sessionExists flag be set to true or false?

Dustin Sallings

unread,
Dec 24, 2020, 1:40:47 PM12/24/20
to mq...@googlegroups.com
Yes, if the cleanSession flag is set, you should destroy any history of the given session.

Some clients/apps can't deal with earlier state.  cleanSession ensures the current client and its current connection has complete knowledge of what's been done.

--
To learn more about MQTT please visit http://mqtt.org
---
You received this message because you are subscribed to the Google Groups "MQTT" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mqtt+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mqtt/ab591307-b90d-4c84-8a05-ce8e87de97a4n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages