-
Notifications
You must be signed in to change notification settings - Fork 23
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
Feature Req: Multiple concurrent MQTT client connections #14
Comments
@markterrill totally hijacking your thread here, but seeing as you are referencing Home Assistant (I assume hass.io et al), I am just about to finish a library for Mongoose OS that exposes lots of things (sensors, binary_sensors, switches, etc) directly to HA in MQTT. You may find that useful? Mail me [email protected] if you'd like to discuss, or join in on gitter.im cesanta/mongoose-os and ping me there. (sorry for the drive-by comment) |
a8f2b0e |
@rojer thanks, looks awesome! I'll happily contribute some docs. After a number of scrolls through the code, am I correct in saying the approach to use the new code is directly access mqtt_conn? IE, in rough pseudo code:
|
I'm sure I'll find out when I directly use it, but asking in case that's not the way it's meant to be used.. |
silly me. stdout / stderr use the active cfg. |
yes, you can use the mqtt_conn interface now to create additional connections. |
Summary
Multiple concurrent MQTT client connections that you can selectively subscribe and publish to.
Use case
Customers are asking for integration of their IoT devices with the likes of Home Assistant. We use MQTT bound to GCP for our command and control which precludes being able to configure the device's MQTT server as their local (or cloud) MQTT instance.
You can't chain their local (or cloud) instance with GCP without significant middleware for certs and customer support. You could forward requests from a pub/sub topic if their MQTT was cloud based, but that incurs extra cost. The cheapest and most efficient way to support these customers is simply having another MQTT client connection handle on the end MOS device.
Personally I see this as very useful more broadly for separating command/control from how you may wish to handle status notifications. IE MOS cloud for fleet management, AWS/GCP/local mqtt etc for status notifications and client app driven configuration changes. Forwarding is cool, but costs $, this costs nothing aside from a few cpu cycles on the iot device.
Lastly, while I'm at it, there are some security/transparency advantages. Some sensitive customer data may not be allowed to transmit to a cloud or third party service. A code audit would show the separation of command and status notifications and you could easily redact sensitive portions from any status requests from the command channel. This would open it up to lower security clearance requirements that mandate local status operation but enable periodic remote management/updates. It'd also satisfy what we call PH1 / Public Health Level 1 requirements that no command/control systems see patient information. I don't currently have that requirement, though one product currently using Particle P1 hardware may require operating on naval craft later in the year.
Implementation ideas
I'd rate my C as moderate, so bear with me re my ideas on mqtt.c.
The text was updated successfully, but these errors were encountered: