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

[beam] add MQTT stream composable #181

Merged
merged 4 commits into from
Nov 7, 2024
Merged

[beam] add MQTT stream composable #181

merged 4 commits into from
Nov 7, 2024

Conversation

Alchez
Copy link
Collaborator

@Alchez Alchez commented Nov 5, 2024

Closes #176


I tested the composable with an Artemis MQTT broker running locally (via https://github.com/agritheory/mqtt-pg-logger) and was able to see logging of published topic messages.

Screencast.From.2024-11-05.16-01-45.mp4

Notes:

  • The output of the composable is a list of messages grouped by the topic, but let me know if you want the signature to be different.
  • Also considered using https://github.com/kaandesu/vue-paho-mqtt since it injects the MQTT client into the Vue instance directly, which is easier to interface, but it doesn't seem to support MQTT v5 yet. I'm not sure if that's a deal-breaker, but https://www.npmjs.com/package/mqtt atleast supports all protocol versions.
  • There's another project that uses a similar composable pattern at https://github.com/tommy44458/mqtt-vue-hook using the mqtt library but I'm not sure if we want to package our own implementation or use that one.

@Alchez Alchez requested a review from agritheory November 5, 2024 10:33
Copy link
Contributor

github-actions bot commented Nov 5, 2024

Coverage Report for ./beam

Status Category Percentage Covered / Total
🔴 Lines 7.77% (🎯 70%) 7 / 90
🔴 Statements 8.42% (🎯 70%) 8 / 95
🔴 Functions 3.84% (🎯 70%) 1 / 26
🔴 Branches 0% (🎯 70%) 0 / 59
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
beam/src/composables/mqtt.ts 0% 0% 0% 0% 8-40
Unchanged Files
beam/src/components/ActionFooter.vue 0% 100% 0% 0% 12-3
beam/src/components/BeamArrow.vue 0% 0% 100% 0% 2-4
beam/src/components/BeamMetadata.vue 0% 0% 0% 0% 2-1
beam/src/components/BeamModal.vue 0% 0% 0% 0% 3-5
beam/src/components/BeamModalOutlet.vue 0% 100% 100% 0% 2
beam/src/components/BeamProgress.vue 0% 0% 0% 0% 10-3
beam/src/components/Confirm.vue 0% 0% 0% 0% 4-5
beam/src/components/ItemCheck.vue 0% 0% 0% 0% 9-3
beam/src/components/ItemCount.vue 0% 0% 0% 0% 18-1
beam/src/components/ListAnchor.vue 0% 100% 100% 0% 1
beam/src/components/ListItem.vue 0% 0% 0% 0% 37-14
beam/src/components/ListView.vue 0% 0% 0% 0% 36-null
beam/src/components/Navbar.vue 0% 0% 0% 0% 13-null
beam/src/components/ScanInput.vue 88.88% 100% 50% 87.5% 23
beam/src/components/SplitColumn.vue 0% 0% 100% 0% 14-8
Generated in workflow #402 for commit dda2701 by the Vitest Coverage Report Action

@agritheory
Copy link
Owner

agritheory commented Nov 5, 2024

The output of the composable is a list of messages grouped by the topic, but let me know if you want the signature to be different.

The composable should ideally accept an array of topics to subscribe to and ignore all others. The topics would probably be managed as part of the application state (Pinia). If you want to subscribe to "all", use the "#" symbol, which is convention in MQTT.

@Alchez
Copy link
Collaborator Author

Alchez commented Nov 6, 2024

@agritheory I've added a fallback to subscribe to all topics via the broker, in case a list of topics isn't provided to the composable.

Copy link
Owner

Choose a reason for hiding this comment

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

What is this filing doing? I don't remember seeing a reviews folder before

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is an API report generated by the API Extractor plugin that I had added back in #136.

It basically lets you verify the public API of the package before it gets converted into documentation by the API Documenter plugin.

Ref: https://api-extractor.com/pages/overview/demo_api_report/

@Alchez Alchez merged commit 0a52246 into development Nov 7, 2024
6 of 7 checks passed
@Alchez Alchez deleted the feat-mqtt-stream branch November 7, 2024 07:31
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.

[beam] MQTT input stream component
2 participants