PWA
Progressive Web Apps are the new standard of web app and something all web developers should be striving for. If you haven't heard of the term PWA or Progressive Web App then get ready to hear it some more, and then some more and then some more again; it is the new benchmark for Web Apps and not just mobile ones at that.
So Nimble Ape set out to help show Novalia the power of the Web and its new technologies, specifically PWAs and Web Bluetooth.
The key thing with the Novalia PWA was that a PWA allowed us to create an application that worked the same as a native application. Once a user had been to the website, they could be offline with no internet connectivity, LieFi as Jake Archibald would put it, or they could just have Airplane mode turned on and still be able to connect to a Novalia Audio Poster, just the same as the native apps Novalia had already created.
Utilising Progressive Web App techniques, the Physical Web and Web Bluetooth (and some magic from Chrome Canary), we get an awesome user experience from this BLE Poster.
Polymer & Web Bluetooth
This PWA is built using the Polymer CLI tool, which constructs the basis of your Web App and allows us to use Polymer components - a really nice and quick way to create a Web App utilising already created Components; in this case, the Polymer Paper Elements, but there are a load out there already!
Once we had the base web app setup, we used the Web Bluetooth Generator from Francois Beaufort at Google to create a JavaScript class for connecting to Novalia's Audio Poster. With less than 30 lines of code, it was dealing with translating Bluetooth Characteristic values to which sound to play and adding the right classes to elements to show and hide them based on the connected state of the poster.