based on http://www.ibm.com/developerworks/library/wa-nodejs-polling-app/