seishun / node-steam

Interface directly with Steam servers from Node.js
MIT License
1k stars 180 forks source link

Update steam_client.js #397

Closed morethanwords closed 7 years ago

morethanwords commented 7 years ago

Adding posibility to configure the socket connection

seishun commented 7 years ago

What's your use case for this?

morethanwords commented 7 years ago

@seishun

What's your use case for this?

I'm using this for set localAddress

seishun commented 7 years ago
  1. Why do you need to set localAddress?
  2. Should we expose all the options if people are only going to use localAddress?
  3. Are you changing localAddress on every connection, or are you using the same localAddress for all connections?
morethanwords commented 7 years ago

@seishun

  1. Why do you need to set localAddress?
  2. Should we expose all the options if people are only going to use localAddress?
  3. Are you changing localAddress on every connection, or are you using the same localAddress for all connections?
  1. I'm using multiple bots on the same server and I want to set unique IP for each bot.
  2. No, user can use steamClient.connect() without options or steamClient.connect({ localAddress: '' }) (all options can be used except the server and port, all options: https://nodejs.org/api/net.html#net_socket_connect_options_connectlistener)
  3. I'm changing localAddress on steam rate limit (429)
seishun commented 7 years ago

I'm using multiple bots on the same server and I want to set unique IP for each bot.

Any particular reason why you want this?

(all options can be used except the server and port, all options: https://nodejs.org/api/net.html#net_socket_connect_options_connectlistener)

Yeah but what options besides localAddress would anyone want to use? Is there any point in allowing to change them?

I'm changing localAddress on steam rate limit (429)

What's 429, HTTP response code? If so, what does it have to do with the Steam connection?

morethanwords commented 7 years ago

@seishun 1 bot can have 1000 items in CS:GO inventory maximum, localAddress is most useful option there, you can have 429 if you checking item prices on Steam Market (20 queries per 5 min. max) and then I can't have my inventory, etc.

seishun commented 7 years ago

Can't you just set localAddress for the HTTP request then?

morethanwords commented 7 years ago

@seishun I did that, but I think it would be better to set localAddress to bot too, and Steam cookies usable only for 1 IP

seishun commented 7 years ago

but I think it would be better to set localAddress to bot too

Why do you think it would make any difference?

Steam cookies usable only for 1 IP

You mean if you request a nonce using requestWebAPIAuthenticateUserNonce while connected to Steam from one IP address, it won't be accepted by the AuthenticateUser web API endpoint from another IP address? If so, I would like to test it for myself, do you happen to have test code nearby?

morethanwords commented 7 years ago

but I think it would be better to set localAddress to bot too Why do you think it would make any difference?

Because sometimes I had bad connection from 1 IP when i used >10 bots, now I can't repeat this situation (maybe it was OVH's problems).

Steam cookies usable only for 1 IP You mean if you request a nonce using requestWebAPIAuthenticateUserNonce while connected to Steam from one IP address, it won't be accepted by the AuthenticateUser web API endpoint from another IP address? If so, I would like to test it for myself, do you happen to have test code nearby?

No, I mean that web cookies (as steamMachineAuth, sessionid, steamLogin and steamLoginSecure), I misunderstood you, client doesn't using the cookies

seishun commented 7 years ago

Because sometimes I had bad connection from 1 IP when i used >10 bots, now I can't repeat this situation (maybe it was OVH's problems).

It could also be a Steam problem. Feel free to let me know if you find concrete evidence that multiple Steam connections from the same IP address cause connection problems.

No, I mean that web cookies (as steamMachineAuth, sessionid, steamLogin and steamLoginSecure), I misunderstood you, client doesn't using the cookies

You said the cookies can be used from only 1 IP address. But which is it? Is it the address that requested the nonce? Is it the address that got the cookies from AuthenticateUser? Or is it the address that used the cookies first?

morethanwords commented 7 years ago

You said the cookies can be used from only 1 IP address. But which is it? Is it the address that requested the nonce? Is it the address that got the cookies from AuthenticateUser? Or is it the address that used the cookies first?

Sorry, that I said were about the web requests (to http://steamcommunity.com/*) with cookies, not about Steam client

I wanted to login each bot on unique IP (web and client) to avoid possible problems

seishun commented 7 years ago

Sorry, that I said were about the web requests (to http://steamcommunity.com/*) with cookies, not about Steam client

I guess you're saying that cookies don't have anything to do with the Steam connection then.

Sorry, I don't want to add an API that only has a theoretical purpose. I've heard of people running >10 bots on the same IP address without issues. If you find that Steam does indeed care about your IP address, let me know and I'll reopen. It will also be easier to decide on how the API should work (I can think of some alternatives to the one you're proposing).