"Without music life would be a mistake"
Or how we had to hack a Chromecast and Raspberry Pi in the name of music.
Okay, first a little background. We - at Bagaar- are involved in all things digital. By nature many of us are interested in discovering new things and that includes music, lots of music. In the past we built a Slack integration that checked the 'current DJ' at the office Last.fm scrobbles and posted them to a Slack channel for all to see.
This worked fine while we were using an Apple Airport and Airplaying our tunes with Spotify.
WebSockets to the rescue
In the office we have a Raspberry Pi connected to a television doubling as office dashboard. It seemed the perfect candidate to host our music tracker. On the Pi we decided to run a little Node.js application that connects to a WebSocket server and waits for commands. Now whenever someone uses the Slack command a webhook on a server is called that sends a message to the Pi over the websocket, which then in turn fetches and parses the Chromecast data and sends it into the originating Slack channel.
Point and case: