lundi 20 avril 2015

Potly on Nodejs - "socket hang up and read ECONNRESET"

I have some error when use Plotly on Nodejs, can you help me?

I write a demo to generate image from splotly api, every 20 seconds, server will create a chart image. Some images is good, but then throw err as image:

enter image description here

enter image description here

My code:

setInterval(function() {
  plotly.getImage(figure, imgOpts, function(error, imageStream) {
    if (error) return console.log(error);
    var time = new Date();
    console.log("1--" + new Date());
    var fileStream = fs.createWriteStream(time + '.png');
    console.log("2--" + new Date());
    imageStream.pipe(fileStream);

    //            setTimeout(function(){
    //                console.log("3--"+new Date());
    //                //createPdfkit(time);
    //            },10000);


    //            imageStream.on('end',function(){
    //
    //            });
  });

}, 20000);

Aucun commentaire:

Enregistrer un commentaire