Tayhayy Posted July 7, 2021 Report Posted July 7, 2021 (edited) I have this code so far origin.js const SteamCommunity = require("steamcommunity"); const origin = new SteamCommunity(); module.exports = { origin }; __________________________________________________________________________________________________ index.js const { origin } = require("./origin.js"); origin.login({ accountName: originuser, password: originpass, authCode: "", twoFactorCode: "", captcha: "" }, function (err) { if (!err) { console.log("logged into origin"); } // call worker }); __________________________________________________________________________________________________ worker.js const { origin } = require("./origin.js"); const { workerData } = require("worker_threads"); origin.editProfile({ customURL: workerData }, function (err) { if (!err) { console.log("changed url on origin"); }); Yet I get an error in worker.js saying I'm not logged in, I assume this is because it is creating a new steamcommunity every time require("./origin.js") is called, so how can I share the same steamcommunity across multiple workers, so I don't have to login inside each worker? Edited July 7, 2021 by Tayhayy Quote
Dr. McKay Posted July 7, 2021 Report Posted July 7, 2021 Your assumption is correct. You could either use IPC to call to the master process and do your steamcommunity work there, or use IPC in the master process to the worker processes to share your login cookies. Tayhayy 1 Quote
Tayhayy Posted July 7, 2021 Author Report Posted July 7, 2021 Any idea on why I can't create a steamcommunity and pass it as workerData? Quote
Dr. McKay Posted July 9, 2021 Report Posted July 9, 2021 When you pass data through IPC like that, it gets serialized and then unserialized on the other end. The nature of a SteamCommunity object actually being a SteamCommunity object doesn't survive that serialization. Quote
Tayhayy Posted July 9, 2021 Author Report Posted July 9, 2021 Could you show me how to share the login cookies and using them to edit the profile? Quote
Tayhayy Posted July 12, 2021 Author Report Posted July 12, 2021 Figured it out thanks for the help 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.