Ha, would you look at the time? I had planned on writing more entries in leading up to showing off Dojo at tonight's Show & Tell meetup. Oh well. There's still plenty more to talk about and to build in the app, so I'll keep posting about the details after I talk about Dojo tonight.
Today, I'll talk about some of the bigger questions about Dojo, before diving into the details about how it works.
- Why would I use Dojo over any other music app?
- How did you come up with the idea for Dojo?
- How does Dojo share data between devices?
1. Why would I use Dojo?
It's simple to use. It does one thing: create a common playlist between a host and a group of guests. It removes the pain of searching for a friend's playlist (on, say, Spotify), joining that playlist, finding your song to add to it, and then clicking the "+" button to then select the friend's playlist. If you've never pulled this off before, I don't blame you.
Dojo's flow for hosting a playlist (we call it a station), is pretty straightforward:
- Click a button to host a station. (You'll be prompted to start Bluetooth if it's off and log in to Spotify if you haven't already, no sweat. FYI, we use Spotify for our music service.)
- Search for and add songs, and wait for any other guests to add songs.
The flow for guests is similar:
- Wait for Dojo to find hosts in its scan. (You'll be prompted to turn on Bluetooth if it's not already on. We use Bluetooth to scan for hosts, more on that below.)
- Click the "join" button for the station it discovers.
- Search for and add songs!
As long as the host and guests are nearby, as if they're on a road trip or at a picnic, Dojo can connect across several devices, both Android and iOS.
2. How did you come up with the idea?
I didn't. Dojo was first brainstormed at a Detroit Labs hackathon in early 2015 by a few of my colleagues, a couple on iOS, a couple on Android. Version 1.0 of Dojo is actually already in the store! We had some downloads, we had some office listening parties. It was fun. Version 1.0 relied on Parse to sync playlists between the playlist host and the guests. We used room codes with version 1.0 to join playlists, where a host generates a room code (and it lived in Parse), and guests could enter that room code to join. So far, Dojo 2.0 (not released yet!) does not use room codes.
In the summer of 2016, one of the designers at Detroit Labs and my iOS colleague who worked on version 1.0 got together to discuss the future of Dojo. Did we want to support and update version 1.0? Did we want to pull the plug on it? They decided to strip Dojo down to the essentials, and give it a facelift. I think the new design looks really good. I've shown the app in action to a few friends and they also like the look. For version 2.0, we made the connection process require only a few taps from the user, and take care of the rest in the background.
We held another hackathon in June 2016 where a handful of us built out the core of Dojo 2.0. We got maybe 80% of the work done then, and we are finishing out the remaining 20% now. We look somewhat like these people. I'm the one on the right.
3. How does Dojo share data?
Dojo uses Bluetooth Low Energy (BLE) to share data. Bluetooth Low Energy is based on GATT, which is a protocol for defining tables of information for services and the data (characteristics) they provide.
We use one BLE service to define what Dojo does, and this service contains two characteristics,
- When a guest wants to request a track, it connects to the host and writes to the track request characteristic the Spotify track ID. The host then reads what was written to that characteristic and adds it to the queue.
- When the currently playing track updates in the host station's music player, the host notifies all connected guests that the track changed, and those guests then update their playing screen with the new song data.
A station host device currently acts as a BLE peripheral, which means that it advertises that it has a BLE service on it (in particular, the Dojo service). A guest device upon launch will scan for nearby devices advertising the Dojo service, making the guest a BLE central device. Clicking "join" will connect to the host BLE device's GATT server. Once connected the guest can interact with the characteristic values that live on the host GATT server.
At the moment, my iOS colleague and I are exploring flipping the central and peripheral role for BLE connections, which will affect how we use these characteristics and the service, but the results of that will be for another post!
More Details Next Time!
In the next several posts, I'll show in code (mostly that fresh, new Kotlin!) how we pulled off all the Bluetooth Low Energy and music magic.
Thanks for reading!