IPC API & Events
The server’s v2 commands are listed below. C# 1.2 adds convenience methods; 1.1.0 can use CallAsync with the method names. Stable state methods return typed results, while other methods return JsonElement. Check system.capabilities against the running SecRandom version.
| Area | v2 methods | C# 1.2 |
|---|---|---|
| System and state | system.ping, system.info, system.capabilities, system.integration.status, state.windows, state.draw, state.runtime |
PingAsync, GetInfoAsync, GetCapabilitiesAsync, GetIntegrationStatusAsync, GetWindowsStateAsync, GetDrawStateAsync, GetRuntimeStateAsync |
| Windows | window.show, window.hide, window.toggle, window.navigate |
SetWindowAsync, NavigateAsync |
| Settings | settings.schema, settings.get, settings.set, settings.page.open |
GetSettingsSchemaAsync, GetSettingsAsync, SetSettingsAsync, OpenSettingsPageAsync |
| Rosters | roster.lists, roster.read, roster.write, roster.activate |
GetRosterListsAsync, ReadRosterAsync, WriteRosterAsync, ActivateRosterAsync |
| Draws | draw.rollCall.*, draw.quick.trigger, draw.lottery.* |
DrawAsync, ConfigureDrawAsync, StartDrawAsync, StopDrawAsync, ResetDrawAsync |
| Results and history | draw.result, draw.await, history.query, history.summary |
GetDrawResultAsync, AwaitDrawAsync, GetHistoryAsync, GetHistorySummaryAsync |
| Event discovery | events.subscribe, events.unsubscribe, events.status |
GetEventStatusAsync, CallAsync; actual events use a separate pipe |
Roll call and lottery support trigger/configure/start/stop/reset; quick draw supports trigger only. draw.await waits for the current draw and returns the latest result; it does not accept a round ID. History queries accept kind (students or prizes) and name; pagination and date filtering are not implemented. Roster reads may be truncated: inspect each list’s truncated flag.
CallForAsync<T> in 1.2 deserializes a v2 result into a caller-defined type. CallLegacyAsync supports v1 routes with no v2 equivalent and returns the complete JSON envelope. Check both success and result.status: business errors can have success: true.
Check the settings schema before writing. Roster replace replaces the target, while merge combines records:
// 1.2; SecRandom may request local authorization.await client.SetWindowAsync(AutomationWindow.Floating, WindowAction.Show);await client.WriteRosterAsync(RosterKind.Students, "Class A", new object[] { new { id = "1", name = "Alice" } }, RosterWriteMode.Merge);Events
Section titled “Events”// 1.2; cancellation closes the subscription.var events = new AutomationEvents();await foreach (var item in events.SubscribeAsync(new[] { "draw.completed" }, cancellationToken)) Console.WriteLine($"{item.Sequence}: {item.Name} {item.Data}");The separate event pipe currently reports changes primarily from automation commands, not every UI action. Its queue can overflow and events are not replayed. After a disconnect, resubscribe and refresh state. Builds containing the event-gate fix reject and close subscriptions when automation IPC is disabled; older builds leave the event pipe enabled independently of that setting.
Receiving Draw Results
Section titled “Receiving Draw Results”NotificationReceiver is a separate user-approved channel. Result notifications and floating-window linkage require the unmodified official client assembly and its SecRandom.Integration.Client.official-proof.json; the proof’s assembly version and SHA-256 must match the loaded DLL. A self-built or modified SDK normally cannot pass official verification, so these two integration features will not work. An official proof cannot validate a different assembly. Single-file publishing or trimming may also affect verification.
You can build your own application; independent drawing and automation IPC do not require an official proof. The user must approve the notification channel in SecRandom. Notification integration on macOS also requires a SecRandom update with the pipe path length fix, which is not included in 3.2.0. Use and dispose the lease from IntegrationIpcClient.AcquireLinkageAsync for floating-window linkage.
The proof identifies the SDK assembly, not the third-party application. See the integration protocol and IPC & URL reference.