Skip to content

Instantly share code, notes, and snippets.

@willyaranda
Created March 20, 2014 15:49
Show Gist options
  • Save willyaranda/9666868 to your computer and use it in GitHub Desktop.
Save willyaranda/9666868 to your computer and use it in GitHub Desktop.
'use strict';
var request = require('request'),
ABOUT_URL = 'https://push-nv.srv.openwebdevice.com/willy';
var debug = function(msg) {
var d = Date.now();
console.error(Date(d).toLocaleString(), d, msg);
};
var requestAbout = function() {
request(ABOUT_URL, function(error, response, body) {
if (error) {
debug(error);
return;
}
if (response.statusCode !== 200) {
debug(response.statusCode);
return;
}
if (body.indexOf('Hello') === -1) {
debug('Bad body' + body);
return;
}
debug('Fine');
});
};
setInterval(requestAbout, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment