joshuaferrara / node-csgo

A node-steam plugin for Counter-Strike: Global Offensive.
MIT License
460 stars 82 forks source link

Cannot connect, stuck at "Sending ClientHello" #60

Closed Yaroslav-95 closed 5 years ago

Yaroslav-95 commented 5 years ago

SInce the gitter chat appears to be dead, I decided to open an issue on matter.

The node steam module successfully connects and logs in, however, after CSGOClient.launch(), it is stuck in a loop constantly trying to send ClientHello, and doesn't move from there.

joshuaferrara commented 5 years ago

Are you providing Steam a list of servers similar to this line in the example or this line in the tests? I just ran the test file and had no issues so it could have also just been a temporary thing.

Yaroslav-95 commented 5 years ago

For some reason it turns out that you have to have played at least one match in CS GO (it can be any match, e.g. casual). Otherwise it won't connect.

joshuaferrara commented 5 years ago

Interesting, thanks for pointing this out! I'd never tested on a fresh account, so that's good to know.

cryptodescriptor commented 5 years ago

Actually, you just need to boot the game. No need to play a match.

PS. Please add my website https://csgo-stalker.com to the list :)

mrmischi3f commented 4 years ago

Hi, I know it's been a long time since the issue was closed but today I started coding a CSGO stats bot and I am having the same problem with clientHello getting stuck. I am logging in with my own account(which I've played around a 100 matches) so it is not a fresh account.

Here is a snippet of what I do:

var Steam = require('steam'),
    steamClient = new Steam.SteamClient(),
    steamUser = new Steam.SteamUser(steamClient),
    steamGC = new Steam.SteamGameCoordinator(steamClient, 730),
    csgo = require('csgo'),
    CSGO = new csgo.CSGOClient(steamUser, steamGC, true);

steamClient.connect();
steamClient.on('connected', function() {
    steamUser.logOn({
      account_name: 'myusername',
      password: 'mypassword',
      two_factor_code: process.argv[2]
    });
});

steamClient.on('logOnResponse', function() {console.log('Connection successful')});

CSGO.launch();

Any idea of what's going on?

jackharrhy commented 4 years ago

@MrLucyfer You're launching CSGO before the steamClient has had time to properly connect,

...
        steamClient.on('logOnResponse', (response) => {
            if (response.eresult !== Steam.EResult.OK) {
                throw new Error(`Failed to log into steam, got respose: ${JSON.stringify(response)}`);
            }

            CSGO.launch();
        });
...

You want to launch CSGO after you get a successful logOnResponse