Starting a remote headless client - glitchfur/NeosVR-Headless-API GitHub Wiki

Thanks to rpyc, it is possible to start and control a headless client on a remote host. This is done by running NeosVR-Headless-API on both the local and remote host and using a communication protocol external to the headless client to issue commands to the console and gather the responses.

Security warning

At the moment, NeosVR-Headless-API does not implement any encryption or authentication of its own when communicating with remote headless clients. This means attackers could intercept or take control of communications with a remote headless client. Only use this feature on a network that you trust, such as an internal LAN or use tunneling technologies such as a VPN or SSH port forwarding.


To get started, follow the steps in Getting started on both your local machine and the remote host that will be running the headless client. Note that while the library needs to be on both machines, your local machine does NOT need to have Steam or the headless client installed to use the remote functionality.

Once you have your Python virtual environment set up on the remote host, run ./rpc_server.py. This is the server that you will be able to connect to and start headless clients (yes, you can have more than one!). By default, it only listens on localhost (127.0.0.1) for security reasons. If you need to change this, pass the --host parameter to listen on a different interface like so:

./rpc_server.py --host 192.168.1.42

Specifying a host of 0.0.0.0 will listen on all interfaces.

Again, the RPC server has no encryption or authentication to speak of. Exercise caution when determining what interfaces to expose it to.

Connecting and starting the client

Activate the Python virtual environment on your local machine now, and import RemoteHeadlessClient.

from neosvr_headless_api import RemoteHeadlessClient

The syntax for calling RemoteHeadlessClient is almost the same as calling LocalHeadlessClient, except that the former includes host and port parameters that it will connect to when starting the headless client.

hc = RemoteHeadlessClient("192.168.1.42", 16881, "/path/to/NeosVR/", config="/path/to/Config.json")
hc.wait_for_ready()

Note that like LocalHeadlessClient, the config parameter is still optional. However, if you do provide it, the configuration file has to already exist on the remote host. Likewise, the path to the headless client itself refers to its path on the remote host. The library does not do any file transfers.

After calling RemoteHeadlessClient, it will connect to the RPC server on the provided host and immediately start a headless client using the given configuration. Once again we call .wait_for_ready() to block until the headless client is actually ready to accept commands.

From this point on, all other methods should behave exactly the same as their local counterparts. Make sure to run .shutdown() when you are done with the server to free your remote host from it.

See Starting a local headless client for some examples on how to use the library, or check out the online documentation for the full syntax of methods.

⚠️ **GitHub.com Fallback** ⚠️