|
1 | 1 | # OpenVR2WS
|
2 |
| -WebSocket server that provides SteamVR data as JSON, download the latest release [here](https://github.com/BOLL7708/OpenVR2WS/releases). |
| 2 | +This is a WebSocket server that provides SteamVR I/O as JSON; allows for fetching of various kinds of data, as well as providing changes to SteamVR settings when sending data upstream. Download the latest release [here](https://github.com/BOLL7708/OpenVR2WS/releases). |
3 | 3 |
|
4 |
| -This application is a WebSocket server that will provide data from SteamVR to any webpage that connects. |
5 |
| -It was made to provide data to a streaming overlay, as a browser source in OBS, but can be used for whatever you find it suitable for. |
6 |
| -To load data you can use standard JavaScript in a modern browser. |
| 4 | +If you want to chat about this application, or discuss solutions involving it, feel free to join the [Discord](https://discord.gg/Cdt4xjqV35) server for my projects. |
7 | 5 |
|
8 | 6 | ## Usage
|
9 |
| -For a working client implementation see `example.html` included in the release, there is a `Example`-button to open it in the application as well. It is using vanilla JavaScript to open a websocket connection to this application. |
10 |
| - |
11 |
| -The page is by default using port `7708` as it's the default for the server, but if you have changed the port in the application you can use that with the example page by adding ˋ?port=#ˋ to the URL where # is your port. |
12 |
| - |
13 |
| -## Commands |
14 |
| -There are a number of commands to send to the server to request data, see below. |
15 |
| - |
16 |
| -### Format |
17 |
| -To the server, send a JSON package with this format |
18 |
| - |
19 |
| - { |
20 |
| - "key":"the_command", |
21 |
| - "device":"device_index", |
22 |
| - "value":"a_value", |
23 |
| - "value2":"another_value" |
24 |
| - } |
25 |
| - |
26 |
| -### Available Commands |
27 |
| -These are the keys to be used. |
28 |
| -* CumulativeStats : Loads current cumulative stats, basically frame data. |
29 |
| -* PlayArea : Loads current play area data. |
30 |
| -* ApplicationInfo : Information regarding the currently running application. |
31 |
| -* DeviceIds : Information regarding currently connected devices, where you get the device indices. |
32 |
| -* DeviceProperty : Specific device properties, supply the device index, and the key for the property as value. |
33 |
| -* InputAnalog : Float values for bound analog inputs. |
34 |
| -* InputPose : Pose data for connected devices. |
35 |
| -* Setting : Load SteamVR setting, section as value, setting as value2. |
36 |
| - |
37 |
| -## Events |
38 |
| -Certain events from SteamVR gets pushed over the connection, things like changing device properties or changes in input sources, these will arrive without you having to request them. |
| 7 | +* [OpenVR2WS-Types](https://www.npmjs.com/package/openvr2ws-types) is a package on NPM with all the requests and responses provided as TypeScript types. |
| 8 | +* [OpenVR2WS-Example](https://github.com/BOLL7708/openvr2ws-example) is an example client implementation that communicates with this application. |
| 9 | + |
| 10 | +Outside of references and examples, the server is connected to on the IP or name of the host, using the supplied port where `7708` is the default. A typical connection URI would be: `ws://localhost:7708` |
| 11 | + |
| 12 | +Then you send and receive JSON messages to it! It's fairly straight forward, see message examples below. |
| 13 | + |
| 14 | +## Messages |
| 15 | +In the `types` package above you can find all available payloads and messages. |
| 16 | +### Requests |
| 17 | +Input messages are requests sent to the server to retrieve on-demand data or to remotely update SteamVR values. |
| 18 | +Example: |
| 19 | +```json |
| 20 | +{ |
| 21 | + "Key": "RemoteSetting", |
| 22 | + "Password": "your_encoded_password_hash", |
| 23 | + "Data": { |
| 24 | + "Section": "steam.app.2494440", |
| 25 | + "Setting": "worldScale", |
| 26 | + "Value": "2" |
| 27 | + }, |
| 28 | + "Nonce": "YourOneTimeReference" |
| 29 | +} |
| 30 | +``` |
| 31 | +Here the `Data` value is flexible, and can be any of the `Data*` classes found in the project, or in the types. |
| 32 | +### Responses |
| 33 | +Output messages are the responses sent to the client from the server, either automatically due to SteamVR events, or as a result after a data request. |
| 34 | +Example: |
| 35 | +```json |
| 36 | +{ |
| 37 | + "Type": "Message", |
| 38 | + "Key": "RemoteSetting", |
| 39 | + "Message": "Succeeded setting steam.app.2494440/worldScale to 1.", |
| 40 | + "Data": null, |
| 41 | + "Nonce": "YourOneTimeReference" |
| 42 | +} |
| 43 | +``` |
| 44 | +Just like above, the `Data` field in this response object is flexible, and can be any of the `Json*` classes found in the project, or in the types. In this example it's empty, and as such set to `null`. |
| 45 | + |
| 46 | +## Projects that use OpenVR2WS |
| 47 | +Here is a non-exhaustive list of projects that rely on this application: |
| 48 | +* [Desbot](https://github.com/BOLL7708/desbot) |
| 49 | + |
| 50 | +If you have a project you want to see on this list, open an issue and I'll check it out 🙂 |
0 commit comments