liamcottle / rustplus.js Goto Github PK
View Code? Open in Web Editor NEWUnofficial NodeJS library for controlling Smart Switches in the PC game Rust
Unofficial NodeJS library for controlling Smart Switches in the PC game Rust
cant conect with rust+ app
How will the program detect that a new entity has registered or that I have been killed?
I get this error in NodeJS console when sending requests through the RustPlus.sendRequest method
Error: Parse Error: Expected HTTP/
at Socket.socketOnData (_http_client.js:509:22)
at Socket.emit (events.js:315:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at Socket.Readable.push (internal/streams/readable.js:223:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
bytesParsed: 0,
code: 'HPE_INVALID_CONSTANT',
reason: 'Expected HTTP/',
rawPacket: <Buffer 88 02 03 e8>
}
Error: Parse Error: Expected HTTP/
at Socket.socketOnData (_http_client.js:509:22)
at Socket.emit (events.js:315:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at Socket.Readable.push (internal/streams/readable.js:223:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
bytesParsed: 0,
code: 'HPE_INVALID_CONSTANT',
reason: 'Expected HTTP/',
rawPacket: <Buffer 88 02 03 e8>
}
But this does not happen on the first request, only after several requests have been successful already.
Is this some sort of throttling message from the rust game server that cannot be read as a HTTP response?
How to run generation rustplus.config.json on ubuntu apache server ??
can modify code to not close after try run chrome launcher ??
i cant found dependencies.
npx @liamcottle/rustplus.js fcm-listen
npx @liamcottle/rustplus.js fcm-register
These two commands will no longer be available when trustplus.js is takedown.
How can we get player tokens, etc.?
Hey. For instance the sendRequest
method can't be promisified with the common tools because it's not returning the error first in the callback. Even if error wasn't possible due to the websocket architecture of listening to messages in the socket and picking the right callback based on seq, I think the first argument to the callback should be null.
Thoughts?
Hi,
I'm trying to use the getMapMarkers call to see if there are any locked crates on the map and if Bradley has been taken. The issues is anytime I call this I'm only getting back Player Tokens, Vending Machines and CH47, even though I can see on the map in game Explosions and Crates. Have you got any idea why this would be happening.
Cheers
I noticed that players near enough to a CCTV that has been requested for a frame at least once will break those players' POVs. Reconnecting to the server (but still staying within the affected area of the CCTV) will temporarily fix it but will only last for a few seconds.
Do you have an idea on why this happens?
Are there any code examples for how to process smart alarms?
running getInfo on the entityId of a smartAlarm doesn't return the message, And its not shown in the FCM notification either, Am I missing something?
AppMessage {response: AppResponse}
response:AppResponse {seq: 1, error: AppError}
error:AppError {error: 'message_not_sent'}
error:'message_not_sent'
rustplus.on('connected', () => { rustplus.sendRequestAsync({ sendTeamMessage: { message: "Message for Team Chats", } }, 2000) .then((message) => { console.log(message); }) .catch((error) => { console.log(error); }) })
According to this issue, push-receiver calls https://fcm.googleapis.com/fcm/connect/subscribe, which will be removed on June 20th this year. There's a replacement library, Arcana, which supposedly does everything push-receiver can do.
I'm making a private BOT now. The code is this
When I run it I get an error like this :
D:\ProjectFile\bot\node_modules\@liamcottle\rustplus.js\rustplus.js:138
let request = this.AppRequest.fromObject({
^
TypeError: Cannot read properties of undefined (reading 'fromObject')
at RustPlus.sendRequest (D:\ProjectFile\bot\node_modules\@liamcottle\rustplus.js\rustplus.js:138:39)
at RustPlus.sendTeamMessage (D:\ProjectFile\bot\node_modules\@liamcottle\rustplus.js\rustplus.js:240:14)
at print (file:///D:/ProjectFile/bot/tool/print.mjs:18:18)
at RustPlus.<anonymous> (file:///D:/ProjectFile/bpt/index.mjs:102:5)
at RustPlus.emit (node:events:394:28)
at WebSocket.<anonymous> (D:\ProjectFile\bot\node_modules\@liamcottle\rustplus.js\rustplus.js:66:22)
at WebSocket.emit (node:events:394:28)
at WebSocket.setSocket (D:\ProjectFile\bot\node_modules\ws\lib\websocket.js:237:10)
at ClientRequest.<anonymous> (D:\ProjectFile\bot\node_modules\ws\lib\websocket.js:974:15)
at ClientRequest.emit (node:events:394:28)
Error: connect ETIMEDOUT 192.248.164.111:28089
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
errno: -4039,
code: 'ETIMEDOUT',
syscall: 'connect',
address: '192.248.164.111',
port: 28089
}
everything worked fine for me, but after I made a mistake in the token, everything stopped working. now, even when changing authorization or specifying the correct token, I get this error all the time
There are a lot of types of Steam IDs, first I tried the one called Steam Id (looks like STEAM_0:0:000000000) but the one needed is called Steam64 id.
I'm testing getEntityInfo with an ID that someone gave me that they got from FCM, but I'm getting a response like this back:
getEntityInfo response message: {"response":{"seq":1,"error":{"error":"not_found"}}}
Here's the code I'm using:
instance.getEntityInfo(40402673, (message) => {
console.log("getEntityInfo response message: " + JSON.stringify(message));
return true;
});
Hello, first I just want to say thank you for this code, I am in the process of porting it to c# :D
The one thing I am missing is finding a list of already paired device ids. it seems i have to have pair.js running while I pair them to get the ID. am i missing something?
(using push-receiver)
Are there plans to add camera interaction, if possible? Right now, this feature is in the rust plus app.
Will battlemetrics online trackers come back to the bot or will they be permanently unavailable?
If the latter, the channel probably shouldn't be created on initialization.
Just wondering if I would be able to make http call requests to the server through api linked buttons on a configured streamdeck panel
So when I use command-line tool fcm-register
to pair server as described in docs Google Chrome should pop out. But instead it's Visual Studio Code with rustplus.js
file. Logs:
D:\rustplus.js>npx @liamcottle/rustplus.js fcm-register
[main 2021-07-20T21:11:03.062Z] window: using vscode-file:// protocol and V8 cache options: bypassHeatCheck
[main 2021-07-20T21:11:03.152Z] update#setState idle
Couldn't find this issue so please tell me if it is duplicate. I also reinstalled Google Chrome, I don't want to touch VS Code for now as I use it constantly & have some settings I would like to keep. Thanks in advance!
new markers update ??
can download map with markers ?
Me and a friend have been making separate bots using the library, but we've noticed it seems to disconnect after a couple of hours usually. There's no error message or crash, but it just stops picking up anything on the listeners until I restart the program or figure out a way to reconnect. I tried to implement a simple fix by listening for a disconnect but that didn't trigger either. Have you had any experience with this?
(More messages were sent after this but aren't picked up)
The readme shows how the facepuch app does this but i havent been able to figure out how to do this for myself
Issue when subscribing with a camera results in error code "ERR_UNHANDLED_REJECTION"
Copied code from the example for rendering, the code works when camera.subscribe line is removed.
wondering how i install and use this i pasted the npm command into cmd and it downloaded but now im lost
There are a number of times when the socket seems to die, or just stop responding for me.
Could we implement some keepalive?
For example if they have ping / pong, or perhaps every minute to do a getServerInfo
request (if no other request has been done).
Obviously i can do this myself, but would love it to be part of the framework.
I'm trying to figure out a way to register a client through a web app and the problem there is that the pair.html has to be launched in the browser with the privacy thingy disabled and so doesn't work in the browser of the client. Would be nice if you find a way around this.
Great project! With the project of Nerif-tafu i've been implementing this in a React, mongoDB, node.js project that aims to copy the entire rust+ functionality and add so much more.
I was just wondering from your project, is everything included that you can get from the rustplus api?
Are there other things you can do? More info you can take?
How did you figure out all the data?
Anyway I can help with further expansion of the project or is everything that you can get from rustplus api already covered?
Hello, and thank you for the great work on reverse engineering rust+ app!
Is there any information available how to listen for smart alarm notifications?
From what I understand based on the discussion in #13, those smart alarm notifications you see in iOS, for instance, would be available as FCM notifications.
However when I trigger a smart alarm in game, I only appear to get this generic server info message in the listen
callback of pair.js. There's nothing about a smart alarm there, however, it does come at the same time when alarm is triggered so I wonder...
{
img: 'https://files.facepunch.com/Alistair/02/05/0T35W1/server-header.png',
port: '28083',
ip: '51.77.57.19',
name: '[RU] Facepunch 4',
logo: 'https://files.facepunch.com/Alistair/02/05/1Z61F1/04_07-48-MagnificentLadybug.png',
id: 'cdfeccce-7c2f-4d02-8a99-b94a183f3ada',
url: 'http://www.playrust.com/',
desc: "This is an official server owned and operated by Facepunch. \\n \\n People are free to speak whatever language they like. Don't be surprised if you get banned for being abusive."
}
can anyone tell me how I can get a token? I searched in pairing, but I didn't really understand anything there
First thanks for this work, it's pretty cool.
I'm wondering if you can provide some examples on how to get entity ids. I've paired and am able to do things like send a team message, but I want to react to smart alarms and I can't see how to find the entity id. Also, are the entities a poll mechanism as opposed to an event?
Seems that some specific servers have issues w/ connecting, in this particular case this issue was on rusticated us main
Error: Parse Error: Expected HTTP/
at Socket.socketOnData (node:_http_client:534:22)
at Socket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Readable.push (node:internal/streams/readable:234:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
Emitted 'error' event on RustPlus instance at:
at WebSocket.<anonymous> (C:\Users\kamrote\Documents\GitHub\bot\node_modules\@liamcottle\rustplus.js\rustplus.js:71:22)
at WebSocket.emit (node:events:513:28)
at emitErrorAndClose (C:\Users\kamrote\Documents\GitHub\bot\node_modules\ws\lib\websocket.js:1002:13)
at ClientRequest.<anonymous> (C:\Users\kamrote\Documents\GitHub\bot\node_modules\ws\lib\websocket.js:854:5)
at ClientRequest.emit (node:events:513:28)
at Socket.socketOnData (node:_http_client:543:9)
at Socket.emit (node:events:513:28)
[... lines matching original stack trace ...]
at Readable.push (node:internal/streams/readable:234:10) {
bytesParsed: 0,
code: 'HPE_INVALID_CONSTANT',
reason: 'Expected HTTP/',
rawPacket: Buffer(4) [Uint8Array] [ 136, 2, 3, 232 ]
}
rustplus.js throw error "ETIMEDOUT" because unhandled 'error' event in rustplus.js when rust server doesn't work .
So program that use rustplus.js will force stop when ETIMEDOUT occur.
before, received a message when electricity was sent to your smart alarm. but recently it stopped working...
its bug? or patched?
(other pairing is received message) code
Hey, i wanted to play around with this a little and made a new project in which i created a index.js and run the require command from the readme - it looks like this:
const RustPlus = require('rustplus-api');
var rustplus = new RustPlus('ip', port, '<steamid>', '<token>');
rustplus.on('message', (message) => {
console.log("message received: " + JSON.stringify(message));
});
rustplus.getEntityInfo(1234567, (message) => {
console.log("getEntityInfo response message: " + JSON.stringify(message));
return true;
});
rustplus.sendTeamMessage('Hello World!', (message) => {
console.log(message);
});
But whenever i call a function that would trigger a request i'm getting this error before it's even executed:
node index.js
H:\SourceCodes\Games\Rust\node-rustplus-test\node_modules\rustplus-api\rustplus.js:130
let message = this.AppRequest.fromObject(payload);
^
TypeError: Cannot read property 'fromObject' of undefined
at RustPlus.sendRequest (H:\SourceCodes\Games\Rust\node-rustplus-test\node_modules\rustplus-api\rustplus.js:130:39)
at RustPlus.getEntityInfo (H:\SourceCodes\Games\Rust\node-rustplus-test\node_modules\rustplus-api\rustplus.js:193:14)
at Object.<anonymous> (H:\SourceCodes\Games\Rust\node-rustplus-test\index.js:21:10)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
Do you know what i'm doing wrong?
would be able to add timestamps for fcm-listen?
I tried
rustplus.sendRequest({ checkSubscription: { entityID: "somerandomentityid" } }, (message) => { console.log(message); });
But this outputs
AppMessage { response: AppResponse { seq: 3, error: AppError { error: 'not_found' } } }
twice
Us there any way to see whenever a game chat message has been sent (and the content on that data)?
Thanks in advance, been using the npmjs package for a week and it's sooo good, great work!
Would be nice to use it directly through a browser client instead of a Node backend
I saw you added some information about cctv frames and i wanted to check that out.
I have some trouble with getting it to work on my testserver, i enabled cctv rendering but the requests always return 0 bytes in GetCameraFrame.getJpgImage. The idenfiier it obv. the cctv name, but i'm not sure what i need to enter into the frame parameter, i tried 0, 90 (fov) and a few others but no success.
Maybe we could add some comments to request/response parameters in the protoc file for the generated code, as described here https://developers.google.com/protocol-buffers/docs/proto#adding_comments
And thanks again for finding all of this out, this is a awesome library.
I'm having the same issue as this
Although it's already solved in latest release, my guess is rust companion still uses an older version of expo. It's not directly a bug with this project so feel free to close this issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.