简体   繁体   English

在Node.js上使用-挂断并读取ECONNRESET

[英]Potly on Nodejs - “socket hang up and read ECONNRESET”

I have some error when use Plotly on Nodejs, can you help me? 在Nodejs上使用Plotly时出现错误,您能帮我吗?

I write a demo to generate image from splotly api, every 20 seconds, server will create a chart image. 我编写了一个演示,从splotly api生成图像,每20秒,服务器将创建一个图表图像。 Some images is good, but then throw err as image: 一些图像是好的,但随后将err作为图像抛出:

在此处输入图片说明

在此处输入图片说明

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); 

" ECONNRESET " in general, means that the connection your making has closed. 通常,“ ECONNRESET ”表示您建立的连接已关闭。

I assume that this error is being logged after the plotly.getImage() ? 我假设在plotly.getImage()之后正在记录此错误? In this case, you'll need to simply handle the error. 在这种情况下,您将只需要处理错误。 if (error) //don't continue The reason for the error could be that the image you're trying to get is not there, if it's not handled accordingly by plotly. if (error) //don't continue错误的原因可能是您试图获取的图像不存在,如果未通过plotly处理的话。 You may have better luck posting on plotly's github issues . 您可能会更好地在plotly的github问题上发帖。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM