seishun / node-steam

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

send method question #363

Closed starwolfy closed 8 years ago

starwolfy commented 8 years ago

I cannot seem to figure out how to use the send method of the Steam client. I have been messing around with parameters and different values but I do not seem to get the proper response from Steam. Could we possibly get more clarification regarding the send function?

Now please note that I have a very limited understanding about protobufs, however I don't feel like advanced knowledge about protobufs is required in order to make use of the send method of node-steam as the usage of the function would probably be rather simple when an example were to be provided. (Please do correct me if I am wrong)

One of my completely faulty attempts is as follows:

var bodyBuffer = new Buffer("optional fixed64 gameid = 730;");
steamClient.send({msg: "CMsgClientUpdateUserGameInfo", proto: {}}, bodyBuffer);

Where I used this protobuf:

message CMsgClientUpdateUserGameInfo {
    optional fixed64 steamid_idgs = 1;
    optional fixed64 gameid = 2;
    optional uint32 game_ip = 3;
    optional uint32 game_port = 4;
    optional bytes token = 5;
}

As of this question, I do not care if this specific message would work due to me maybe having to send more information. I am more asking how one should send a client message in general. Could anyone give me an example on how to send a protobuf to Steam using the client's send function?

seishun commented 8 years ago

As stated in the README, all bundled handlers internally send and receive low-level client messages using 'message'/send. Here's one trivial example.

You'll need a protobuf library and Steam's protobuf definitions to send a protobuf-backed message. node-steam-resources provides all of that.

Feel free to ask if you have any further questions.