What's Brewing: Laid To REST
/I recently participated in Art Hack Day: Afterglow at Transmediale. Art Hack Day is a pop-up art exhibit/hackathon that has had events in many places. The projects I work on at these events tend to use Spacebrew because:
- It is an easy way for me to re-use pre-existing clients while testing.
- I don't need to worry about who is the server and who is the client (especially when I have five clients all talking to each other!) Everyone connects to the Spacebrew server, and I route from there.
- Hopefully I end up with new re-usable clients at the end.
- I learn how to make Spacebrew better.
For the Transmediale exhibit I created a piece that memorialized dead links on the internet. I knew I was going to use a receipt printer to print out the URL's (both because I am obsessed with receipt printers and I already had a receipt printer Spacebrew client). The question was how to find the links.
I did a quick search for "nodejs web crawler" and ended up using a module named crawler. All I had to write was a script to identify 404 responses and publish the corresponding URL to Spacebrew. 100 lines of code later (mostly just edited from examples) I had the 404-logging web crawler.
There is a peculiarity with the receipt printer client I use where it doesn't like to receive new messages until the previous message finishes printing, so I whipped together a quick queuing client to store messages until the printer is ready again, and voila! I was done with the technical work.
You can see a couple of button clients and a chat client used for debugging, and the web crawler (404'd), rate limiter, and Thermal Printer clients which drove the installation. This ran for 4 days (I had to restart the web crawler at one point because it ran out of memory), and Spacebrew didn't complain once!
My code resides in this github repo in case you want to poke around in a completely unreadable mess!