{"id":16995090,"url":"https://github.com/raphiiko/oyasumivr_oscquery","last_synced_at":"2025-04-12T05:39:09.034Z","repository":{"id":212160452,"uuid":"730848660","full_name":"Raphiiko/oyasumivr_oscquery","owner":"Raphiiko","description":"Limited OSCQuery implementation in Rust for use with VRChat.","archived":false,"fork":false,"pushed_at":"2025-04-11T22:37:46.000Z","size":31253,"stargazers_count":18,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-12T05:38:57.587Z","etag":null,"topics":["osc","oscquery","rust","rust-lang","vrchat"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Raphiiko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-12-12T20:06:53.000Z","updated_at":"2025-04-11T22:37:51.000Z","dependencies_parsed_at":"2023-12-12T21:26:13.218Z","dependency_job_id":"6943e660-81bc-4a9d-a45a-2402bc71ffad","html_url":"https://github.com/Raphiiko/oyasumivr_oscquery","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"2599fba448a89b178d468bcb3d400c8a4c711d7b"},"previous_names":["raphiiko/oyasumivr_oscquery"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raphiiko%2Foyasumivr_oscquery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raphiiko%2Foyasumivr_oscquery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raphiiko%2Foyasumivr_oscquery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raphiiko%2Foyasumivr_oscquery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Raphiiko","download_url":"https://codeload.github.com/Raphiiko/oyasumivr_oscquery/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248525169,"owners_count":21118617,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["osc","oscquery","rust","rust-lang","vrchat"],"created_at":"2024-10-14T03:47:32.930Z","updated_at":"2025-04-12T05:39:09.005Z","avatar_url":"https://github.com/Raphiiko.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# oyasumivr_oscquery\n\nLimited OSCQuery implementation in Rust, for use with VRChat.\n\nThis library allows for:\n\n1. Advertising your OSC server to VRChat using OSCQuery. (For receiving OSC data from VRChat)\n2. Finding VRChat's own OSC and OSCQuery servers. (For sending OSC data to VRChat)\n\n**It is _not_ a full implementation of OSCQuery:** It _only_ implements the parts that are needed for interacting with VRChat. It does not handle the sending and receiving of OSC packets, for that you'll need to use a crate like [rosc](https://crates.io/crates/rosc).\n\nIts main reason for existence is to add OSCQuery support to [OyasumiVR](https://github.com/Raphiiko/OyasumiVR).\nPull requests are welcome, however feature requests will likely go ignored, as this library is more of a personal means to an end.\n\nRoughly based on specifications from the [OSCQuery Proposal](https://github.com/vrchat-community/osc/wiki/OSCQuery) and [VRChat's OSCQuery documentation](https://github.com/vrchat-community/osc/wiki/OSCQuery).\n\n## Usage\n\nBelow you'll find some simple examples of how to use this library. For more detailed examples that you can run straight out of the box, please check the [examples](https://github.com/Raphiiko/oyasumivr_oscquery/tree/main/examples) directory.\n\n### Include the library in your project\n\nAdd the following dependency to your `Cargo.toml`:\n\n```toml\n[dependencies]\noyasumivr_oscquery = { git = \"https://github.com/Raphiiko/oyasumivr_oscquery.git\" }\n```\n\n### Include the sidecar executable in your project\n\nThis library depends on a dotnet based sidecar executable that needs to be included with your project. You can find it by:\n1. Downloading the [built executable](https://github.com/Raphiiko/oyasumivr_oscquery/blob/main/lib/mdns-sidecar.exe) from this repository\n\nor\n\n2. Building it yourself by cloning this repository and running `./build.sh`. The executable will end up in `lib/mdns-sidecar.exe`.\n\nYou will need to ship this executable with your project, with the rest of your program's files. The upcoming examples will show you how to refer to it.\n\n### Sending (to VRChat)\n\n#### Find VRChat's OSC and OSCQuery servers\n\nYou can find the addresses for VRChat's OSC and OSCQuery servers as follows.\nNote that these can only be found while VRChat is running.\nWhen VRChat is restarted or OSC is disabled/enabled, these addresses (and ports especially) _may_ change, so make sure to check these functions for changes regularly.\n\n```rust\n// Start looking for VRChat's OSC \u0026 OSCQuery services.\noyasumivr_oscquery::client::init(\n    \"./lib/mdns-sidecar.exe\" // The (relative) path to the mdns-sidecar.exe executable\n).await.unwrap();\n\n// Wait a bit for the MDNS daemon to find the services\ntokio::time::sleep(tokio::time::Duration::from_millis(2000)).await;\n\n// Get the address of the VRChat OSC server\nlet (host, port) = oyasumivr_oscquery::client::get_vrchat_osc_address()\n    .await\n    .unwrap();\nprintln!(\"VRChat OSC address: {}:{}\", host, port);\n\n// Get the address of the VRChat OSCQuery server\nlet (host, port) = oyasumivr_oscquery::client::get_vrchat_oscquery_address()\n    .await\n    .unwrap();\nprintln!(\"VRChat OSC Query address: {}:{}\", host, port);\n```\n\n### Receiving (from VRChat)\n\n#### Listen for data from VRChat\n\n```rust\n// Initialize the OSCQuery server\noyasumivr_oscquery::server::init(\n    \"OyasumiVR Test\",         // The name of your application (Shows in VRChat's UI)\n    8085,                     // The port your OSC server receives data on\n    \"./lib/mdns-sidecar.exe\", // The (relative) path to the MDNS sidecar executable\n).await.unwrap();\n\n// Configure which data we want to receive from VRChat\noyasumivr_oscquery::server::receive_vrchat_avatar_parameters().await; // /avatar/*, /avatar/parameters/*, etc.\noyasumivr_oscquery::server::receive_vrchat_tracking_data().await; // /tracking/vrsystem/*\n\n// Now we can start broadcasting the advertisement for the OSC and OSCQuery server\noyasumivr_oscquery::server::advertise().await.unwrap();\n```\n\n#### Expose custom OSC Methods\n\nBefore you saw how to easily expose the right OSC methods for use with VRChat, by calling functions like `receive_vrchat_avatar_parameters` and `receive_vrchat_tracking_data`.\n\nIf you want to expose your own OSC methods, you can do so like follows:\n\n```rust\n// Initialize the OSCQuery server\noyasumivr_oscquery::server::init(...).await.unwrap();\n\n// Configure the OSC Query server by registering addresses we're interesting in receiving\n// Getting VRChat avatar parameters\noyasumivr_oscquery::server::add_osc_method(OSCMethod {\n    description: Some(\"VRChat Avatar Parameters\".to_string()),\n    address: \"/avatar\".to_string(),\n    // Write: We only want to receive these values from VRChat, not send them\n    ad_type: oyasumivr_oscquery::OSCMethodAccessType::Write,\n    value_type: None,\n    value: None,\n})\n.await;\n\n// Now we can start broadcasting the advertisement for the OSC and OSCQuery server\noyasumivr_oscquery::server::advertise().await.unwrap();\n```\n\n#### Change the advertised port of your OSC server\n\nIf you change the address your OSC server runs on, you can update the advertised port at any time, even after you've already started (advertising) your OSC \u0026 OSCQuery servers.\nYou can do this by calling the `set_osc_port` function:\n\n```rust\noyasumivr_oscquery::server::set_osc_port(8082).await;\n```\n\nThe advertisements will automatically be updated!\n\n#### Expose OSC method values over OSCQuery\n\nAlthough irrelevant for use with VRChat, with this library you can also expose values for your OSC methods over OSCQuery, so that they become queryable.\n\n```rust\noyasumivr_oscquery::server::set_osc_method_value(\"/foo/bar\".to_string(), Some(\"1\".to_string())).await;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphiiko%2Foyasumivr_oscquery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraphiiko%2Foyasumivr_oscquery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphiiko%2Foyasumivr_oscquery/lists"}