seishun / node-steam

Interface directly with Steam servers from Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: reconnect

batizisanya opened this issue · comments

Hi, I want some help. I wrote a steam bot with node-csgo, and sometimes randomly disconnect from steam, and crash. Can you help for me to handle this type of error and reconnect to steam and also restart? node-csgo.
Last log:
2 May 01:06:35 - node-csgo unready.
events.js:160
throw er; // Unhandled 'error' event
^

Error: Disconnected
at SteamClient._disconnected (/xxx/node_modules/steam/lib/steam_client.js:186:24)
at emitOne (events.js:96:13)
at Connection.emit (events.js:188:7)
at TCP._handle.close [as _onclose] (net.js:509:12)

Can you help for me?

commented

var steamClient = new Modules.steam.SteamClient();
steamClient.on('error', function(error) {
if (steamClient.loggedOn == false) steamClient.connect();
});

You handle it by adding an event handler for the 'error' event'.