Every quarter, Solace’s PubSub+ Cloud team participates in a two-day hackathon. It’s an opportunity to experiment with the Solace PubSub+ Platform, either by utilizing it in a novel way or extending the platform itself. It’s also a great way to work side by side with others on the team that we haven’t had a chance to work with and possibly dabble in other areas.
Our team’s goal for the hackathon was to provide an IoT hub where users only had to worry about writing code and could leave the other details to us. PubSub+ Event Broker is an extremely powerful and versatile broker with a staggering number of features across many protocols. Within two days we went from an idea to actually creating the IoT hub. This article shares how we used PubSub+ Event Broker: Cloud to develop the hub.
The IoT Hub uses PubSub+ Cloud to provision event brokers. When a new device is registered on the hub, a new client username is created on the event broker.
This is as simple as adding a device from the IoT hub’s UI.
We used the ACL substitution variables of PubSub+ to ensure that each device only has access to their own topic space. This was all done with a straightforward integration with the PubSub+ Cloud REST API and SEMP.
We then offered some useful shortcuts for developers who want to dive straight into coding. There are Java and Python snippets ready to download and run, pre-populated with your connection details.
For easier debugging, we also display recent events within your topic space and provide a way to publish events right from the hub.
./run.sh and you’re publishing and subscribing!
Now we needed devices to use the IoT hub. Our choice? Nerf guns.
We created an internet-connected target and score display. Using code samples and connection details from the hub, we were able to start iterating immediately.
When the target powers on, it sends a registration event to the hub. A micro switch push button is depressed when the target is hit. The button triggers “hit” events to be published to the hub. The score display receives the “hit” events and updates the score.
The hub gave us a fast and simple way to start publishing, subscribing, and seeing events. We were able to add the score display as a second device with the press of a button, giving it its own set of credentials. This quick validation allowed us to concentrate on the actual events instead of debugging connection parameters.
Solace has participated in many university hackathons, exposing students to event-driven architecture and getting them to think beyond REST. However, many students don’t have much experience with event brokers.
Historically, we helped students sign up for PubSub+ Cloud and guided them through connecting their applications. One of the broker’s greatest assets of being language agnostic and multi-protocol ended up being overwhelming with so many different ways to connect.
We thought the IoT hub could resolve all of these. Choosing MQTT as the protocol, picking which libraries to use for the different languages, and setting up the connection parameters gave students a baseline functionality they could start with. As they explored more advanced use-cases, we could point them to PubSub+ Cloud, but they were armed with a working prototype.
In two days, we had a few tweaks to help us out during an upcoming university hackathon. First, we secured the dashboard with our company’s SSO. This allowed all the Solace volunteers to create new devices (i.e. credentials) and help students debug issues by viewing their connection details. Then, we added a way to generate unauthenticated, hard-to-guess links to the different devices so we could easily onboard the students. Finally, we polished up the interface, added more samples, and hosted the application online.
During the hackathon, we started seeing the benefits immediately. We were able to help students debug simple issues by checking out their connection details and using the hub to publish events to their applications. Instead of the usual questions about how to connect, we heard “How can we tell when a client disconnects?” (will messages) and “Can I publish with one protocol and subscribe with another?” (absolutely!). Without being bogged down by connection issues, students were starting to think beyond the basics and concentrating on the events!
The IoT Hub wasn’t the most elaborate use of what Solace has to offer, it was a few opinionated integrations with Solace products that are readily available to anyone. The only difference is that we have the valuable experience of advising countless customers on their event-driven architecture and guiding users to proven patterns.
We hope to bring these lessons to our products. Who knows, maybe sometime in the future you’ll see an “IoT Hub” icon appear in PubSub+ Cloud and you’ll be assured that you have the expertise of Solace powering your products.
The post Developing an IoT Hub to Facilitate the Support of Your IoT Architecture appeared first on Solace.