大家好我需要一些帮助,我的应用程序一直关闭我的连接,我似乎无法修复它“错误:连接丢失:服务器关闭了连接。”我需要处理重新连接,但我不知道如何。
这是我的输出(错误)
C:\Users\qw\Desktop\bot>node bot1.js
[SERVER] The Bot has logged in!
[SERVER] Loading Prices - API prices loaded!
[SERVER] The web cookies have been set!
events.js:141
throw er; // Unhandled 'error' event
^
Error: Connection lost: The server closed the connection.
at Protocol.end (C:\Users\qw\Desktop\bot\node_modules\mysql\lib\protocol\Pro
tocol.js:103:13)
at Socket.<anonymous> (C:\Users\qw\Desktop\bot\node_modules\mysql\lib\Connec
tion.js:102:28)
at emitNone (events.js:72:20)
at Socket.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:905:12)
at nextTickCallbackWith2Args (node.js:474:9)
at process._tickCallback (node.js:388:17)
C:\Users\qw\Desktop\bot>pause
Press any key to continue . . .
我的代码
var Steam = require('steam');
var SteamUser = require('steam-user');
var TradeOfferManager = require('steam-tradeoffer-manager');
var SteamTotp = require('steam-totp');
var TOTP = require('onceler').TOTP;
var request = require('request');
var SteamCommunity = require('steamcommunity');
var community = new SteamCommunity();
var fs = require('node-fs');
// GENERAL INFORMATION
var sitepath;
sitepath = "";
var sitename;
sitename = "";
var apik = "";
var admin = '';
var botsteamid = '';
var identitysecret = '';
var sharedsecret = '';
var polling_interval = 10000;
var rsecret='';
var snipetimer=5;
var GameTime = 120;
var p2=false;
var playersRequired=2;
var details = {
"accountName" : "",
"password" : "",
"twoFactorCode" : SteamTotp.generateAuthCode(sharedsecret)
};
var client = new SteamUser();
var manager = new TradeOfferManager({
"steam" : client,
"domain" : "localhost",
"language" : "en"
})
var mysql = require('mysql');
var sql_host="";
var sql_user="";
var sql_password="";
var sql_database="";