Feature: Pre-registered links and simplified client-server setup #183
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR introduces a new concept of
links
which brings a couple of benefits.emitter/link/
channel.Creating Links
In order to create a link, a JSON-formatted message must be sent to
emitter/link/
MQTT topic. The message should contain at least the alphanumeric name (max 2 characters), a valid key and a channel. It optionally can contain a "subscribe" or "private" flags.If subscribe flag is set to true and a channel key has a subscribe (read) permission, then emitter broker will automatically subscribe the client to the channel.
If the private flag is set to true and a channel key has an "extend" permission as shown in the screenshot below, then the channel will be made private by appending a connection identifier string to the provided channel.
For example, if you request the above private link to be created, 3 things will happen on emitter broker:
.../a/b/c/F45JPXDSXVRWBUKTDNCCM4PGQ/
)1
to that private sub-channel (e.g.1
->.../a/b/c/F45JPXDSXVRWBUKTDNCCM4PGQ/
Then, by simply issuing a PUBLISH onto the topic
1
the broker will route the message in the private channel. Note that you can still manually create a wildcard key fora/#/
in order to create a "server" client which will be able to see everything.