Jump to content
McKay Development

Session is lost / invalid after running for a while


Recommended Posts

Posted (edited)

I've recently rewritten an old project from scratch using the latest module versions, I'm encountering a Problem where my bot works fine, however after running for a while (days / weeks) it tends to throw Not Logged In errors and does not recover from this situation.

I have had this problem in the old code and implemented a duct tape solution there by listening to `manager._community.on('debug')` and calling `steamUser.webLogOn()` if the log contains "Not Logged In", however obviously this is very hacky and probably not intended.

My Setup is as follows:

  1.  TradeofferManager is passed my own instances of SteamUser and SteamCommunity
  2.  `steamUser.logOn()` => `steamUser.on("webSession")` => `tradeofferManager.setCookies()`

Is there something else that I should listen to besides "webSession" to be notified of new cookies?

My Module Versions are:

  • "steamcommunity": "^3.47.1"
  • "steam-tradeoffer-manager": "^2.10.6"
  • "steam-user": "^5.0.4"

Thanks

Edit: This probably should've been categorized under steam-user sorry, my bad.

Edited by Kinsi55
Posted (edited)

Either listen for steamcommunity's sessionExpired event and then call webLogOn(), or set up a timer to call webLogOn() periodically. Hourly works good for me.

webSession is the correct way to listen for new cookies. The Steam backend doesn't proactively send you new cookies when your session expires; it's up to you to request new ones.

Edited by Dr. McKay

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...