DentFuse Posted March 12, 2018 Report Posted March 12, 2018 Hi all, So this is my code : community.on('sessionExpired', (err) =>{ console.log("Session Expired !! Logging In Again...") if (a = 1) { a = 0 login(); } }); community.on('disconnected', (err) =>{ console.log("Disconnected !! Logging In Again...") if (a = 1) { a = 0 login(); } }); So what is happening is that the sessionExpired is being called but when the bot is trying to log in, it crashes with an error stating that we are already logged in and we cannot log in again, also sometimes the bot crashes with an error saying the session was replaced or something like that, sorry I don't exactly remember, will post log when it happens again. Any help would be greatly appreciated PS: I've added that var a to make sure that the login function is called only once, I change it back to 1 once we get the webapi key from steam. Quote
Dr. McKay Posted March 13, 2018 Report Posted March 13, 2018 It's being called for a reason, and that reason is that your session expired. I assume that you're getting your session from node-steam-user, and you're calling logOn when it expires. That's wrong, you should call webLogOn. DentFuse 1 Quote
DentFuse Posted March 14, 2018 Author Report Posted March 14, 2018 It's being called for a reason, and that reason is that your session expired. I assume that you're getting your session from node-steam-user, and you're calling logOn when it expires. That's wrong, you should call webLogOn. Hey there! Thanks for your reply, so do you mean to say that I don't have to log in again when the session expires, but just call webLogOn(which gets a new session from steam? That's what I understood when I was reading the docs of node-steam-community)So all I have to do is replace my login function with a call to webLogOn ? PS: I knew it was being called because our session expired, but wasn't sure why it was not logging in again... Quote
Dr. McKay Posted March 14, 2018 Report Posted March 14, 2018 Correct. When you're using steam-user, your "login" is a connection to the CM. It's completely distinct from your web session. When your web session expires but you're still connected you don't need to reconnect. Just get a new web session which requests new cookies from the CM. Quote
DentFuse Posted March 16, 2018 Author Report Posted March 16, 2018 Correct. When you're using steam-user, your "login" is a connection to the CM. It's completely distinct from your web session. When your web session expires but you're still connected you don't need to reconnect. Just get a new web session which requests new cookies from the CM. Now I get error saying that we must be logged in steam before we can login in steamcommunity.com. Should I call my login func before webLogOn ? Quote
DentFuse Posted March 24, 2018 Author Report Posted March 24, 2018 Okay so update on my bot, couldn't get the sessionExpired thing working,tried .relog(), .webLogOn(), .LogOn(), still couldn't get it working, so I just attached the bot to forever, so like when ever it crashes due to sessionExpired, it just restarts it. Happens once a day, so that's not much of a problem, but yeah, thanks you for answers PS: I'll still try to get it working ;P Quote
Recommended Posts
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.