Ably is the platform that powers synchronized digital experiences in realtime. Whether attending an event in a virtual venue, receiving realtime financial information, or monitoring live car performance data – consumers simply expect realtime digital experiences as standard. Ably provides a suite of APIs to build, extend, and deliver powerful digital experiences in realtime for more than 250 million devices across 80 countries each month. Organizations like Bloomberg, HubSpot, Verizon, and Hopin depend on Ably’s platform to offload the growing complexity of business-critical realtime data synchronization at global scale. For more information, see the Ably documentation.
This repository contains the code required as both a web server and the code hosted on the IoT device (the Badger 2040W badge) to demonstrate real time communication using Ably's Channels. Anyone with access to the server URL can submit (publish) messages via the form. The Badger 2040W (subscriber) can then receive the message, use APILayer's Bad Words API to filter out any profanity, and then display this message on the screen.
This demo uses:
- A Badger 2040 W (Pico W Aboard) as the wearable item,
- A case 3d printed by files found on Printables,
- A Node server to allow people to send messages with Ably using the Channels API,
- MicroPython on the Badger 2040 W, to subscribe to the Ably Channel, and display this message on the screen,
- APILayer's Bad Words API to lightly moderate the use of any inappropriate language.
You'll need to run the server, and have a wearable such as the Badger 2040 W.
- Clone this repository.
- Run
npm install
in the root folder. - Rename the
.env.example
file to.env
. - Copy/paste the Ably API key in the
ABLY_API_KEY
field in the.env
file. - Define your Ably Channel in the
ABLY_CHANNEL
field in the.env
file. - Run
npm run dev
in the root folder. - Open
http://localhost:8080/
in your browser, you'll be presented with:
- Install Thonny a Python IDE that lets you interface with the Raspberry Pi Pico sitting under the Badger 2040W,
- Connect to the Pico via Thonny and a USB cable,
- Copy the contents of
/wearably-snippet/ably.py
as a new file on the Pico, - Update the value of
BAD_WORDS_API_KEY
with your APILayer Bad Words API key, - Update the values of
ABLY_API_KEY
andABLY_CHANNEL
with your Ably API key, and the desired channel to subscribe to, - Click run on Thonny to be presented with
Hello, welcome to the Ably Subscriber Badge.
on the Badger 2040W screen.
Want to help contributing to this project? Have a look at our contributing guide!
If you have used this as a base for getting started on your own projects or ideas, please do reach out to me! I'd love to know more about you and what you've produced. For more questions or comments, please contact me on Twitter, or on our Ably Discord.