How vrchat-community/vrc-oscquery-lib works
Project Type and Purpose
• This is a cross-platform C# .NET library (“vrc-oscquery-lib”) implementing the OSCQuery protocol. It provides:
• Service discovery via mDNS/Zeroconf
• An embedded HTTP/1.1 server exposing a JSON tree of OSC endpoints
• A fluent builder API for library consumers to advertise and manage OSC methods
• It’s accompanied by console-app examples (DataSender, DataReceiver, LogAdvertisers), a Unity example project (OSCQueryExplorer-Unity), and unit tests.
Key Architectural Components
a. Core Library (vrc-oscquery-lib)
• OSCQueryServiceBuilder → configures and constructs an OSCQueryService
• OSCQueryService → hosts:
– Zeroconf advertiser (in Zeroconf/MeaModDiscovery.cs)
– HTTP server (listening on a TCP port, parses URLs into OSCQueryNode lookups)
– In-memory node tree (OSCQueryNode, OSCQueryServiceProfile)
• Public API: AddEndpoint/RemoveEndpoint to manage OSC address entries
• Resource: embedded OSCQueryExplorer.html returned by HTTP when “?explorer” is appended
b. Discovery Layer
• Zeroconf library for mDNS advertising of “_oscjson._tcp” service type
• Example “LogAdvertisers” console app listens for these advertisements
c. HTTP Layer
• HTTP 1.1 listener (depending on .NET HTTPListener or Kestrel)
• JSON serialization of node tree and attributes
• Query-string parsing for explorer UI or host info
d. Consumers / Examples
• DataSender: advertises its own OSCQuery/OSC service and exposes random int endpoints
• DataReceiver: DNS-discovers services, polls HTTP for JSON updates
• OSCQueryExplorer-Unity: Unity runtime client showing scenes for sending/receiving OSC via library
• TerminalGuiAddons: shared UI helpers for console apps
e. Testing
• Unit tests in Tests/vrc-oscquery-tests cover core model and spec compliance