[英]Potly on Nodejs - “socket hang up and read ECONNRESET”
在Nodejs上使用Plotly時出現錯誤,您能幫我嗎?
我編寫了一個演示,從splotly api生成圖像,每20秒,服務器將創建一個圖表圖像。 一些圖像是好的,但隨后將err作為圖像拋出:
我的代碼:
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 ”表示您建立的連接已關閉。
我假設在plotly.getImage()
之后正在記錄此錯誤? 在這種情況下,您將只需要處理錯誤。 if (error) //don't continue
錯誤的原因可能是您試圖獲取的圖像不存在,如果未通過plotly處理的話。 您可能會更好地在plotly的github問題上發帖。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.