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

Added support for MQTT retain and rewritten in-memory storage #190

Merged
merged 5 commits into from
Feb 24, 2019

Conversation

kelindar
Copy link
Contributor

@kelindar kelindar commented Feb 24, 2019

This PR adds support for MQTT Retain flag. In order to make retained messages play well with emitter's message history, we consider that the retained messages are just messages with a large TTL (defaults to 30 days ). The retain TTL is configurable in the storage provider, so you can setup a longer or shorter time.

  1. The retain flag will only work if the key has store permission
  2. The subscriptions with load permission will default to last=1 . This is done in order to be compliant with the MQTT spec as the retain message should always be sent to the subscriptions.

Now, you can still have ttl and last options and it should play well with the retained messages, sending everything.

@coveralls
Copy link

coveralls commented Feb 24, 2019

Coverage Status

Coverage increased (+0.2%) to 91.023% when pulling b1ead39 on feat-retain into ff99255 on master.

Copy link
Member

@Florimond Florimond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kelindar kelindar merged commit 66aca78 into master Feb 24, 2019
@kelindar kelindar deleted the feat-retain branch February 24, 2019 11:34
Florimond pushed a commit that referenced this pull request Sep 7, 2023
This PR adds support for MQTT Retain flag. In order to make retained messages play well with emitter's message history, we consider that the retained messages are just messages with a large TTL (defaults to `30 days` ). The `retain` TTL is configurable in the storage provider, so you can setup a longer or shorter time.

1. The retain flag will only work if the key has `store` permission
2. The subscriptions with `load` permission will default to `last=1` . This is done in order to be compliant with the MQTT spec as the retain message should always be sent to the subscriptions.

Now, you can still have `ttl` and `last` options and it should play well with the retained messages, sending everything.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants