Created
September 14, 2015 07:29
-
-
Save ar2rsawseen/8838c50bf8692d28b8ab to your computer and use it in GitHub Desktop.
Generate requests for Countly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'); | |
function makeRequest(cnt){ | |
var options = { | |
uri: 'http://localhost/i?app_key=ccab3e6e1b5ca7b42fc2194b57358b115edb45fc&device_id='+Math.random()+'&begin_session=1&events=[{%22key%22:%22click%22,%22count%22:1,%22segmentation%22:{%22message%22:%22a%22}},{%22key%22:%22go%22,%22count%22:1,%22segmentation%22:{%22message%22:%22b%22}},{%22key%22:%22do%22,%22count%22:1,%22segmentation%22:{%22message%22:%22c%22}}]', | |
method: 'GET' | |
}; | |
request(options, function (error, response, body) { | |
if(!error){ | |
try{ | |
var arr = JSON.parse(body); | |
console.log(cnt, arr); | |
} | |
catch(ex){} | |
} | |
}); | |
} | |
function iterateRequest(){ | |
makeRequest(1); | |
setTimeout(iterateRequest, 1000); | |
} | |
/* | |
for(var i = 0; i < 100000; i++){ | |
makeRequest(i); | |
} | |
*/ | |
iterateRequest(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment