Jump to content
McKay Development

Bot keeps disconnecting from Steam


mantelis123

Recommended Posts

Hello, I own a trade bot. This evening I have noticed that my bot began to behave strangely. It starts disconnecting from Steam and changes its status to offline. Logs are totally clean. No errors. Also, I am using a function "webLogOn" to destroy expired session and re-create it. Do you have any suggestions?

Edited by mantelis123
Link to comment
Share on other sites

Hello, I own a trade bot. This evening I have noticed that my bot began to behave strangely. It starts disconnecting from Steam and changes its status to offline. Logs are totally clean. No errors. Also, I am using a function "webLogOn" to destroy expired session and re-create it. Do you have any suggestions?

Do you have 'disconnected' event (from steam-user)?

It should show the reason why you get disconnected

Link to comment
Share on other sites

Do you have 'disconnected' event (from steam-user)?

It should show the reason why you get disconnected

I currently don't have this event because I tough that steam-community event "sessionExpired" would be enough. When this event fires, I call steam-user client.webLogOn(), but this night I've noticed that when "sessionExpired" event gets called, it starts reconnecting, but doesn't fully reconnect: http://prntscr.com/fktl8y In this case my bot turns offline again and I have to restart it. I will try to add "disconnected" event, but what function exactly should I write there? Delete and re-create the session (client.webLogOn()) or totally log off from steam user and login again?

Edited by mantelis123
Link to comment
Share on other sites

I currently don't have this event because I tough that steam-community event "sessionExpired" would be enough. When this event fires, I call steam-user client.webLogOn(), but this night I've noticed that when "sessionExpired" event gets called, it starts reconnecting, but doesn't fully reconnect: http://prntscr.com/fktl8y In this case my bot turns offline again and I have to restart it. I will try to add "disconnected" event, but what function exactly should I write there? Delete and re-create the session (client.webLogOn()) or totally log off from steam user and login again?

 

Something like this:

community.on("sessionExpired", function(err) {
	//client.webLogOn and stuff
});

client.on('disconnected', function (eresult) {
	console.log("Disconnected from Steam. Reason '"+SteamUser.EResult[eresult]+" ["+eresult+"]'");
        //do your magic
});

node-steamcommunity 'sessionExpired' event will fires if your cookies is dead (but still connected to Steam)

node-steam-user 'disconnected' event will fires if your bot for some reason can't connect to Steam server.

 

For example, try log in your bot using your code with 'disconnected' event code above, and after that turn off your internet connection.

The log will say something like: "Disconnected from Steam. Reason 'NoConnection [3]'"

Link to comment
Share on other sites

Something like this:

community.on("sessionExpired", function(err) {
	//client.webLogOn and stuff
});

client.on('disconnected', function (eresult) {
	console.log("Disconnected from Steam. Reason '"+SteamUser.EResult[eresult]+" ["+eresult+"]'");
        //do your magic
});

node-steamcommunity 'sessionExpired' event will fires if your cookies is dead (but still connected to Steam)

node-steam-user 'disconnected' event will fires if your bot for some reason can't connect to Steam server.

 

For example, try log in your bot using your code with 'disconnected' event code above, and after that turn off your internet connection.

The log will say something like: "Disconnected from Steam. Reason 'NoConnection [3]'"

 

I started the bot, turned off my wifi and after 30 seconds turned it on again. Then the bot connected to Steam immediately, there was no need to call "login" function in "disconnected" event because I have found in steam-user documentation that bot automatically logs in when it is disconnected from Steam: http://prntscr.com/fkv1oj

But the problem is that when my bot goes offline, it doesn't log in back again and starts spamming "Session expired. Reconnecting...", but never fully reconnects: http://prntscr.com/fktl8y

client.on('disconnected', function(eresult, msg) {
	console.log('Disconnected.');
	if (typeof eresult !== 'undefined') {
		console.log('EResult: ' + eresult);
	}
	if (typeof msg !== 'undefined') {
		console.log('Message: ' + msg);
	}
});

community.on('sessionExpired', function(err) {
	console.log('Session expired. Reconnecting...');
	client.webLogOn();
});
Edited by mantelis123
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...