Jump to content
McKay Development

Recommended Posts

Posted

I use Digitalocean myself, either for deployment of web apps and or bots.

I an used that but hane problem - Error polling for trade offers: Error: socket hang up. Mb you can tell me how check this problem, which rules need in firewall? Or mb have tutorial 

Posted

I usually use the one-click NodeJS app that they provide & it always seems to work with no issues. The error you get: Error polling for trade offers: Error: socket hang up, might be a code error and not a server host error.

  • 2 weeks later...
Posted

I usually use the one-click NodeJS app that they provide & it always seems to work with no issues. The error you get: Error polling for trade offers: Error: socket hang up, might be a code error and not a server host error.

const SteamUser = require('steam-user');
const SteamTotp = require('steam-totp');
const SteamCommunity = require('steamcommunity');
const TradeOfferManager = require('steam-tradeoffer-manager');
const config = require('./config.js');
let winston = require('winston'); // For logging
const client = new SteamUser();
const community = new SteamCommunity();

let logger =  winston.createLogger({
    transports: [
        new (winston.transports.Console)({
            colorize: true,
            level: 'debug'
        }),
        new (winston.transports.File)({
            level: 'info',
            timestamp: true,
            filename: 'cratedump.log',
            json: false
        })
    ],
});
const manager = new TradeOfferManager({
  steam: client,
  community: community,
  language: 'en'
});

const logOnOptions = {
  accountName: config.username,
  password: config.password,
  twoFactorCode: SteamTotp.generateAuthCode(config.shared_secret)
};

client.logOn(logOnOptions);

client.on('loggedOn', () => {
  logger.info("Logged into Steam");
  client.setPersona(SteamUser.Steam.EPersonaState.Online);
  client.gamesPlayed(740);
});

client.on('webSession', (sessionid, cookies) => {
  manager.setCookies(cookies, (err) => {
    if (err) {
        logger.error('Unable to set trade offer cookies: ' + err);
        process.exit(1); // Fatal error since we couldn't get our API key
        return;
    }
    logger.info("Trade offer cookies set.  Got API Key: " + manager.apiKey);
});
  community.setCookies(cookies);
});

manager.on('pollFailure', (err) => {
    console.log(err);
    logger.error("Error polling for trade offers: " + err);
});



I  use this.

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