You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Readme.md
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,17 @@ This library does not yet return limited attributes based on query strings, like
22
22
## ⚡️ Basic Use
23
23
24
24
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).
25
-
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.
25
+
2. Construct a new OSCQuery service.
26
+
-**Important**: If you want to customize settings (name, ports, etc.), configure them **before** calling `WithDefaults()`, as `WithDefaults()` immediately starts the HTTP server and advertising.
27
+
```csharp
28
+
varservice=newOSCQueryServiceBuilder()
29
+
.WithTcpPort(Extensions.GetAvailableTcpPort())
30
+
.WithUdpPort(Extensions.GetAvailableUdpPort())
31
+
.WithServiceName("MyService")
32
+
.WithDefaults()
33
+
.Build();
34
+
```
35
+
26
36
3. You should now be able to visit `http://localhost:tcpPort` in a browser and see raw JSON describing an empty root node.
27
37
- 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.
28
38
4. You can also visit `http://localhost:tcpPort?HOST_INFO` to get information about the supported attributes of this OSCQuery Server.
Copy file name to clipboardExpand all lines: getting-started.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,6 +27,7 @@ The format is always `new OSCQueryServiceBuilder()`, followed by all the things
27
27
There's a lot of options you _can_ configure if you want more control over what happens. The additional methods are listed below. Note that if you do not add any fluent options, then `WithDefaults()` is called for you automatically.
28
28
29
29
* WithDefaults()
30
+
***Important**: This immediately starts the HTTP server and advertising. Configure all settings (ports, names, etc.) **before** calling this method.
30
31
* Sets up Discovery, Advertising and HTTP serving using default names and ports.
31
32
* WithTcpPort(int port)
32
33
* Set the TCP port you want to use for serving the HTTP endpoints. Defaults to any available open TCP port.
@@ -53,15 +54,16 @@ There's a lot of options you _can_ configure if you want more control over what
* Adds a listener which will be sent OSCQueryServiceProfiles for newly-discovered OSC or OSCQuery services.
55
56
56
-
You can can add these onto`.WithDefaults()` if you want _almost_ all the defaults. For example, this code will have all the defaults, but find the first available TCP port instead of 8060, and uses the name "MyService" instead of "OSCQueryService".
57
+
**Important**: You must configure settings **before** calling`.WithDefaults()`, as `WithDefaults()` immediately starts the HTTP server and advertising. Settings configured after `WithDefaults()` will not be applied.
57
58
58
59
```csharp
59
60
varoscQuery=newOSCQueryServiceBuilder()
60
-
.WithDefaults()
61
61
.WithTcpPort(Extensions.GetAvailableTcpPort())
62
62
.WithServiceName("MyService")
63
+
.WithDefaults()
63
64
.Build();
64
65
```
66
+
65
67
## A Simple Example
66
68
67
69
A minimal example for a working OSCQuery Service could look like this:
@@ -71,10 +73,10 @@ var tcpPort = Extensions.GetAvailableTcpPort();
71
73
varudpPort=Extensions.GetAvailableUdpPort();
72
74
73
75
varoscQuery=newOSCQueryServiceBuilder()
74
-
.WithDefaults()
75
76
.WithTcpPort(tcpPort)
76
77
.WithUdpPort(udpPort)
77
78
.WithServiceName("MyService")
79
+
.WithDefaults() // Configure settings BEFORE calling WithDefaults()
78
80
.Build();
79
81
80
82
// Manually logging the ports to see them without a logger
0 commit comments