Jump to content
McKay Development

Question about getting logged off after some time (days)


mar71n

Recommended Posts

To describe my problem: Everything runs smoothly until a few days went by. Then I'm apparently not logged in anymore (I get 'Error: Not Logged In' when trying to send a tradeoffer). I would prefer to deal with beeing logged of instead of relogging based on the errorcallback when sending the trade.

 

First: autoRelogin doesn't seem to handle that issue, is autoRelogin ONLY for the weekly downtime that happens on tuesday?  

 

Second: Since this is quite hard to test (I don't know how to force it, maybe by logging into the client manually while the bot is logged in?), I hope to find the answer here: 

 

Will the error / disconnect fire when I get logged out / the session expires, and is it enough to just do a new logOn() then?

 

Thanks in advance!
** **
Edit: What I was able to test so far: Logging in manually into the client kills the session. 

If that happens, the error and the disconnect-event don't fire.

If I try to just do client.logOn again, I get the error "already logged on".

 

Edit2: Looks like I found a fix, client.webLogOn(); does the trick. Is there a more elegant way of dealing with this issue other than just relogging when the error happens? I would prefer to relog after getting logged out / The session expiring.client.webLogOn(); 

 

Edit3: People told me to listen for the sessionExpired event and to renew the session if it fires. However this event doesn't fire when I manually destroy the cookies, and it doesn't fire when I make the cookies invalid by logging into the client manually. When does it fire?

My solution for now: I have a cronschedule that does webLogOn() every 45 min (does that time make sense?), and whenever that error fires I also do a webLogOn(). Still not satisfied by that solution tbh tho. 

Edited by mar71n
Link to comment
Share on other sites

If you are using node-steamcommunity functions not that often, you can do this:

client.once(`webSession`, () => {
// Now you should be able to do all your steamcommunity related stuff safely
});
client.webLogOn();
Edited by Royalgamer06
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...