In this article I'll demo some code that uses Sidekiq for asynchronous background job processing. Since I like using headless browsers, I decided to create a worker that uses PhantomJS to create a screenshot for each page request, and a Sinatra front-end with a Google Analtyics-like JS include.

Browse to Sinatra via http://localhost:4567, and click around on the randomly generated links. Each page request calls analytics.js as a JS include, which asynchronously calls the worker. The worker dumps screenshots into the public folder.

Browse to the Sidekiq dashboard to check out the job queues, http://localhost:9494

Next steps: create an admin dashboard that shows the screenshots realtime via a websocket connection...