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

Use URL-safe Base64 encoding for the topic name #112

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexander-akhmetov
Copy link

@alexander-akhmetov alexander-akhmetov commented Aug 24, 2024

Use url-safe base64 encoding to encode the topic name. It allows subscribing to topics with special characters in the name, for example $SYS/+, etc.

Fixes #111, #105, #90

How to test

  1. Start Grafana with the plugin:
mage -v
yarn build
GRAFANA_VERSION=11.1.0 yarn run server
  1. Run the test MQTT broker:
node scripts/test_broker.js
  1. Create a new MQTT data source: tcp://host.docker.internal:1883

  2. Subscribe to $SYS/my:topic/second/1 in Explore

@alexander-akhmetov alexander-akhmetov force-pushed the alexander-akhmetov/encode-topic-name branch 3 times, most recently from eb56fae to 4ef2524 Compare August 24, 2024 11:58
@alexander-akhmetov alexander-akhmetov marked this pull request as ready for review August 24, 2024 12:02
There are some restrictions to what characters
are allowed to use in a Grafana Live channel:
 https://github.com/grafana/grafana-plugin-sdk-go/blob/7470982de35f3b0bb5d17631b4163463153cc204/live/channel.go#L33

To comply with these restrictions, the topic is
encoded using URL-safe base64 encoding.
(RFC 4648; 5. Base 64 Encoding with URL and Filename Safe Alphabet)
@alexander-akhmetov alexander-akhmetov force-pushed the alexander-akhmetov/encode-topic-name branch from 4ef2524 to 4c52831 Compare August 24, 2024 12:25
@gtalusan
Copy link

Would love to see this merged.

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.

Error / ":" in mqtt topic name not resolved (Shelly mqtt topic messages)
2 participants