OrchestratorHttpServer
The orchestrator's tiny web server: serves the dashboard page and a JSON state document, and forwards commands (POST) to the main thread.
Nebula · Packages/com.1by3.nebula/Runtime/Orchestrator/OrchestratorHttpServer.cspublic sealed class OrchestratorHttpServer : IDisposableThe orchestrator's tiny web server: serves the dashboard page and a JSON state document, and forwards commands (POST) to the main thread. Runs on Mono's managed HttpListener, so it needs no URL ACLs and no external dependencies. Reads are answered from the listener thread with the last published state; writes are queued and executed by Pump from the orchestrator's Update, and the HTTP response waits for that.
Constructors
OrchestratorHttpServer
public OrchestratorHttpServer(string bind, ushort port, string page, string artifactDir = null);| Parameter | Description |
|---|---|
bind | "localhost" (default), "+" / "*" for every interface, or one address. |
artifactDir | Directory served read-only under /build/ (the Linux server tarball worker VMs fetch); null disables. |
Properties
Url
public string Url { get; }Methods
Start
public void Start();PublishState
public void PublishState(string json);Replace the state document served by GET /api/state. Call from the main thread whenever something changed.
Pump
public void Pump(Func<Request, Response> handler);Main thread: execute queued commands. Each waiting HTTP response is released with the handler's result.
Dispose
public void Dispose();TryGetInt
public static bool TryGetInt(string body, string key, out int value);Reads an integer property from a flat JSON object body (the dashboard only ever sends {"key": value}).
GetString
public static string GetString(string body, string key);Reads a string property from a flat JSON object body; "" when absent.
Nested types
Request
public sealed class RequestFields
Method
public string Method;Path
public string Path;Body
public string Body;Response
public struct ResponseFields
Status
public int Status;ContentType
public string ContentType;Body
public string Body;Methods
Json
public static Response Json(int status, string body);Error
public static Response Error(int status, string message);