OSCQuery is a protocol that makes it easier for OSC apps to find and communicate with each other.
This implementation of the protocol is made for OSC app creators integrate into their own projects as we have integrated it into VRChat. We've built it in C# targeting .NET 6 and Framework 4.6 so it will work in Unity as well as cross-platform .NET projects.
This library implements almost all of the Core Functionality as described in the proposal:
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.
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.http://localhost:tcpPort
in a browser and see raw JSON describing an empty root node.
http://localhost:tcpPort?explorer
to see an OSCQuery Explorer UI for the OSCQuery service, which should be easier to navigate than the raw JSON.http://localhost:tcpPort?HOST_INFO
to get information about the supported attributes of this OSCQuery Server.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.http://localhost:tcpPort/foo/bar
.RemoveEndpoint()
method on your OSCQueryService instance, passing in the OSC address as a string ("/foo/bar");Dispose
to clean it up.For a more detailed walkthrough see Getting Started
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.
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:
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
This scene implements receving ChatBox messages in the same way that VRChat does for easy testing.
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:
Known Issues:
Read more: OSC Trackers for VRChat.
This scene implements receiving Tracking messages in the same way that VRChat does for easy testing.
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.
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.
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