liamcottle / rustplus.js

Unofficial NodeJS library for controlling Smart Switches in the PC game Rust
228 stars 46 forks source link

How to use subscriptions? #12

Closed D3XX3R closed 3 years ago

D3XX3R commented 3 years ago

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

liamcottle commented 3 years ago

Unfortunately I have no idea what this request actually does. However it was available in the rust+ app, so I included it here for completeness. Please let me know if you figure it out :)

liamcottle commented 3 years ago

Just checked this out, and for future reference I will document it here.

The rust+ app has a switch in smart alarm settings to toggle notifications on and off. If it's on, you will receive a push notification when your smart alarm is triggered, and if it's off, you won't receive a push notification.

You can use the checkSubscription request via the websocket to check the current notification setting for the smart alarm by entity id.

You can use setSubscription with value set to true or false to enable/disable the notifications being sent when the smart alarm is triggered.