VRChat.OSCQuery 0.0.6

There is a newer version of this package available.
See the version list below for details.
dotnet add package VRChat.OSCQuery --version 0.0.6                
NuGet\Install-Package VRChat.OSCQuery -Version 0.0.6                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="VRChat.OSCQuery" Version="0.0.6" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add VRChat.OSCQuery --version 0.0.6                
#r "nuget: VRChat.OSCQuery, 0.0.6"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install VRChat.OSCQuery as a Cake Addin
#addin nuget:?package=VRChat.OSCQuery&version=0.0.6

// Install VRChat.OSCQuery as a Cake Tool
#tool nuget:?package=VRChat.OSCQuery&version=0.0.6                

VRC OSCQuery

OSCQuery is a protocol that makes it easier for OSC apps to find and communicate with each other.

VRC OSCQuery Routing

We're developing this implementation of the protocol for OSC app creators integrate into their own projects as we integrate it into VRChat. We're building it in C# targeting .NET 6 and Framework 4.6 so it will work in Unity as well as cross-platform .NET projects.

πŸ”¨ Functionality

This library implements almost all of the Core Functionality as described in the proposal:

  • Advertises the service type "_oscjson._tcp" on the local network over Zeroconf.
  • HTTP 1.1 Server
  • Parses request url paths for OSC methods
  • Provides JSON objects describing those OSC methods
  • Discards fragment of url path
  • Returns HTTP Status / Error codes

This library does not yet return limited attributes based on query strings, like only returning the VALUE of an object for a url that ends in "?VALUE", and does not yet return all possible error strings.

⚑️ Basic Use

  1. Build vrc-oscquery-lib into vrc-oscquery-lib.dll and add it to your project (will make this a NuGet package once it's ready for wider use).
  2. Construct a new OSCQuery service with new OSCQueryServiceBuilder().WithDefaults().Build(). T optionally passing in the name, TCP port to use for serving HTTP, UDP port that you're using for OSC, and an ILogger if you want logs.
  3. You should now be able to visit http://localhost:tcpPort in a browser and see raw JSON describing an empty root node.
    • You can also visit http://localhost:tcpPort?explorer to see an OSCQuery Explorer UI for the OSCQuery service, which should be easier to navigate than the raw JSON.
  4. You can also visit http://localhost:tcpPort?HOST_INFO to get information about the supported attributes of this OSCQuery Server.
  5. Next, you can call AddEndpoint on your service to add information about an available OSC method. Note that this library does not send or receive OSC messages directly, it is up to you to choose and implement an OSC Library.
  6. After you have added an endpoint, you can its information by querying the root node again, or query for your method specifically. If you added an endpoint for the OSC address "/foo/bar", you would query this method directly at http://localhost:tcpPort/foo/bar.
  7. To remove the endpoint, call the RemoveEndpoint() method on your OSCQueryService instance, passing in the OSC address as a string ("/foo/bar");
  8. When you are done with the service, call Dispose to clean it up.

For a more detailed walkthrough see Getting Started


πŸ±β€πŸTesting with VRChat

This functionality will be released in an update soonβ„’. These instructions

After launching the OSCQuery-enabled client, VRChat will start up an OSCQuery Service if you have OSC turned on. Note that we've changed the functionality of the OSC toggle a bit so you may need to turn it on every time you launch for now. VRChat will start a TCP service at http://localhost:9001 by default, or whatever port you have specified with your launch arguments. You can visit this url in a regular web browser to see the plain JSON which is returned for a request to the root namespace.

You can use the Unity App example which is included in this repo as source as well as in the Releases to test automatically connecting to VRChat and sending text to the Chatbox or receiving outgoing data over OSC.

Try opening up two instances of the app to see VRChat send to both automatically.

✨ Examples

Unity App

You can find a Unity Project in Exampless/OSCQueryExplorer-Unity - you can open this up in Unity 2019.4.31f1.

Latest Release: OSCQueryExplorer-Unity 0.0.5 for Windows

This app has six active scenes, and a "SceneChanger" to switch between them:

Chatbox-Sender

This scene demonstrates how to find an OSC receiver compatible with your data and send it. It is similar to how VRChat implements its find-and-send logic. All of the code is in a single MonoBehaviour - ChatboxSender.cs.

https://user-images.githubusercontent.com/737888/196586397-31c4d862-f119-4dce-97a2-375b212f27ca.mp4

Chatbox-Receiver

This scene implements receving ChatBox messages in the same way that VRChat does for easy testing.

Tracker-Sender

This scene uses the same logic to find an OSC receiver compatible with Tracking data and send it.

https://user-images.githubusercontent.com/737888/198946626-033c8192-9b55-4b37-ac33-115e9dcd0ceb.mp4

You can test it using a second window or device, which is running the Tracking-Receiver scene.

To use it with VRChat:

  1. Start VRChat in VR mode.
  2. Start OSCQueryExplorer-Unity and press "OSC-Trackers" on the menu page.
  3. Wait until the app connects to your VRChat client. Leave it on the T-Pose animation.
  4. In VRChat, open your QuickMenu and press "Calibrate FBT".
  5. Wait for the avatar to reload, then press both triggers on your VR controllers.
  6. Back in OSCQueryExplorer, press "Test-Motion" to send some virtual tracker data to VRChat.

Known Issues:

  • In a mirror, the movements will look backwards πŸ˜›
  • Hands are still tracked by controllers, so elbow movements may not do much
  • The example video is at potato resolution, sorry

Read more: OSC Trackers for VRChat.

Tracker-Receiver

This scene implements receiving Tracking messages in the same way that VRChat does for easy testing.

Head & Wrist Receiver

This scene implements receiving VR system tracking data for the head and wrists that VRChat sends out to aid in things such as pose solving or drift correction in OSC Tracker apps. This scene also implements receiving the OSC bundle timestamp that is made available with the tracking data.

image

Monitor

This scene advertises itself as a receiver of OSC data, which VRChat will find and connect to. All of the code is in a single MonoBehaviour - MonitorCanvas.cs

https://user-images.githubusercontent.com/737888/196583859-6616b260-87c7-43a9-b6cc-26cfc110fbfe.mov

This scene advertises randomly named OSC and OSCQuery and Services, and shows the names and ports of any other services it finds on the network. Handy for seeing what's available and testing your own applications. Makes a nice quick phone-to-phone demo as well.

Console Apps

The solution includes three simple examples to demonstrate and test functionality. They are both .NET 6 Console apps and should work on Windows, Mac and Linux, but have only been tested on Windows 10 so far.

https://user-images.githubusercontent.com/737888/186757165-e47f766f-3bc2-46b2-8580-8fd99c6ce6b9.mp4

<details> <summary>

LogAdvertisers

</summary>

This program simply listens for OSCQuery and OSC Service advertisements on the local network and prints them to the console. For OSCQuery services, it will also print the node tree of the service.

</details>

<details> <summary>

DataSender

</summary>

This program will advertise itself as an OSCQuery and OSC Service and provide 10 randomly-named int parameters with random values to test the remote reading of OSC methods and values.

image

When it starts, it generates a random name, TCP and OSC ports. It is possible that these ports are already occupied or are even the same (though unlikely). You can change the name and ports before pressing "Ok".

image

After you press ok, it will display the OSC addresses and values of 10 integer parameters. You can press the name of any address to change its value to a new random integer.

</details>

<details> <summary>

DataReceiver

</summary>

image

This program will start with a list of available OSCQuery services found on your local network. If one is found, you can choose it from the list and press "Connect".

image

Once connected, the program should display the target OSCQuery service's name and TCP port at the top of its window, and list the methods and their values below that.

It regularly polls for updates and should show value changes soon after they occur on the target Service.

</details>


πŸ“ To-Dos:

  • Support query strings for choosing attributes to return

🏞 Roadmap:

  1. Internal Discovery and Iteration
  2. Integrate into VRChat Client
  3. Closed Beta Release to OSC App Developers
  4. General Release of Library and VRChat Client integration
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on VRChat.OSCQuery:

Package Downloads
VolcanicArts.VRCOSC.SDK

SDK for creating custom modules with VRCOSC

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on VRChat.OSCQuery:

Repository Stars
VolcanicArts/VRCOSC
Modular OSC program creator, toolkit, and router made for VRChat. Show your heartrate, time, hardware stats, speech to text, control Spotify, and more! Includes drag-and-drop prefabs for your avatar.
BoiHanny/vrcosc-magicchatbox
The ultimate companion, whether you're on desktop or in VR, we've got you covered with our handy integrations in a compact and modern UI
Version Downloads Last updated
0.0.7 1,120 8/22/2023
0.0.6 226 8/2/2023