liamcottle / rustplus.js

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

Keep alive #35

Closed psykzz closed 1 year ago

psykzz commented 2 years ago

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.

liamcottle commented 1 year ago

There's no ping/pong message implemented in the protocol as the official app doesn't need it. They already do a getInfo request every few seconds.

I think for now, since the rust+ server enforces rate limits, I don't want the library to consume requests that are just going to be discarded. This would also mean responses would be triggered for message listeners, and users might be confused as to why they are receiving messages for something they never requested.

Related Issue: https://github.com/liamcottle/rustplus.js/issues/16