Jump to content
McKay Development

Recommended Posts

Posted (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 by Tayhayy
  • Tayhayy changed the title to Sharing the same steamcommunity across multiple workers
Posted

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.

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