Jump to content
McKay Development

webLogOn strange behavior


Recommended Posts

From time to time (I think when more time has elapsed) webLogOn won't work properly, i have to wait for about 3-4 minutes (with message HTTP error 401) to send trade offer.

Example debug output:

..................................................

info: Offer type receive----Error: HTTP error 401
info: Resend because of error ----Error: HTTP error 401
info: Offer type receive----Error: HTTP error 401
info: Resend because of error ----Error: HTTP error 401
info: Offer type receive----Error: HTTP error 401
info: Resend because of error ----Error: HTTP error 401
info: Offer type receive----Error: HTTP error 401
info: Resend because of error ----Error: HTTP error 401
info: Logged into Steam as xxxxx
debug: Got web session
debug: Trade offer cookies set.  Got API Key: xxxxxx
 
My send offer function:
 
function sendOffer(offer, tradeToken, offerType, socketClient, bot, gameId) {
 
    offer.send('', tradeToken, function (err) {
        if (err) {
 
            bot.webLogOn(function (sessionID, newCookie) {
                getSteamAPIKey({
                    sessionID: sessionID,
                    webCookie: newCookie
                }, function (err, APIKey) {
                    offers.setup({
                        sessionID: sessionID,
                        webCookie: newCookie,
                        APIKey: APIKey
                    });
                });
            });
            logger.info('Offer type ' + offerType + '----' + err);
 
            if (err == 'Error: HTTP error 401' || err == 'Error: HTTP error 503') {
                logger.info('Resend because of error ----' + err);
 
                sendOffer(offer, tradeToken, offerType, socketClient, bot, gameId);
            } else {
                if (offerType == 'receive') {
                    console.log('receive' + err);
                    socketClient.emit('send-offer-error', err);
                }
            }
 
        } else {
            .......
    });
}
Edited by mouzes1
Link to comment
Share on other sites

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