Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protocol Compliant - Session Present Flag #163

Closed
emqplus opened this issue Jun 7, 2015 · 0 comments
Closed

Protocol Compliant - Session Present Flag #163

emqplus opened this issue Jun 7, 2015 · 0 comments
Assignees
Milestone

Comments

@emqplus
Copy link
Contributor

emqplus commented Jun 7, 2015

Position: bit 0 of the Connect Acknowledge Flags.

If the Server accepts a connection with CleanSession set to 1, the Server MUST set Session Present to 0 in the CONNACK packet in addition to setting a zero return code in the CONNACK packet [MQTT-3.2.2-1].

If the Server accepts a connection with CleanSession set to 0, the value set in Session Present depends on whether the Server already has stored Session state for the supplied client ID. If the Server has stored Session state, it MUST set Session Present to 1 in the CONNACK packet [MQTT-3.2.2-2]. If the Server does not have stored Session state, it MUST set Session Present to 0 in the CONNACK packet. This is in addition to setting a zero return code in the CONNACK packet [MQTT-3.2.2-3].

The Session Present flag enables a Client to establish whether the Client and Server have a consistent view about whether there is already stored Session state.

Once the initial setup of a Session is complete, a Client with stored Session state will expect the Server to maintain its stored Session state. In the event that the value of Session Present received by the Client from the Server is not as expected, the Client can choose whether to proceed with the Session or to disconnect. The Client can discard the Session state on both Client and Server by disconnecting, connecting with Clean Session set to 1 and then disconnecting again.

If a server sends a CONNACK packet containing a non-zero return code it MUST set Session Present to 0 [MQTT-3.2.2-4].

@emqplus emqplus self-assigned this Jun 7, 2015
@emqplus emqplus added this to the 0.9.0 milestone Jun 7, 2015
@emqplus emqplus modified the milestones: 0.12.0, 0.9.0, 0.11.0 Aug 19, 2015
emqplus pushed a commit that referenced this issue Nov 5, 2015
fix issue #163 - Protocol Compliant - Session Present Flag
@emqplus emqplus modified the milestones: 0.13.0, 0.11.0 Nov 5, 2015
@emqplus emqplus closed this as completed Nov 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant