2 var http = require("http");
4 var visitCommand = JSON.stringify({name: 'visit', args: ['http://www.google.es']});
5 var renderCommand = JSON.stringify({name: 'render', args: ['/Users/juan/Downloads/page_image.png', true, null]});
13 'Content-type': 'application/json',
14 'Content-Length': visitCommand.length
18 var postRequest = http.request(postOptions, function(res){
19 res.setEncoding('utf8');
20 res.on('data', function(chunk){
25 postRequest.write(visitCommand);
28 postOptions.headers['Content-Length']=renderCommand.length;
29 postRequest = http.request(postOptions, function(res){
30 res.setEncoding('utf8');
31 res.on('data', function(chunk){
36 postRequest.write(renderCommand);