Star Comms Shard Owner API Client.

A framework-agnostic TypeScript client for interacting with a Star Comms shard. Uses the native fetch API (Node 18+, Bun, Deno, or browser).

Supports event-emitter style event handling with Type Safety:

import { StarCommsClient } from "@30k/starcomm-client";

const client = new StarCommsClient({
baseUrl: "http://your-shard:1234",
ownerApiKey: "scok_your_key_here",
});

client.on("user.joined", (event) => {
console.log(`${event.data.displayName} connected`);
});

client.on("ptt.start", (event) => {
console.log(`${event.data.userId} transmitting on net ${event.data.netId}`);
});

// Lifecycle events
client.onLifecycle("stream.disconnected", ({ reason }) => {
console.warn("Stream lost:", reason);
});
client.onLifecycle("stream.reconnected", ({ attempt }) => {
console.log("Reconnected after", attempt, "attempts");
});

await client.connect(); // opens SSE stream and starts dispatching events

// Resource calls
const status = await client.status.get();
await client.assignments.set("discord_user_id", 1);

// Later: disconnect
client.disconnect();

Constructors

Properties

Net archive CRUD and sync status.

assignments: AssignmentsResource

Net assignment operations (assign, unassign, bulk, temporary).

Communication operations (ACARS alerts, client disconnect).

Shard metrics, Prometheus export, audit log, and debug.

Voice net management (create, rename, remove).

operations: OperationsResource

Operation lifecycle, feature flags, and auto-assignment rules.

Operation preset management (save, apply, remove).

Public net feature management (show, hide, remove, restore).

Shard health, status, roster, and embed endpoints.

Event streaming (SSE) and public token management.

Webhook registration and management.

Accessors

  • get connected(): boolean

    Whether the event stream is currently connected.

    Returns boolean

Methods

  • Opens the SSE event stream and begins dispatching events to registered handlers. Call this after registering your .on() handlers.

    Parameters

    • Optionalreconnect: ReconnectOptions

      Options controlling auto-reconnection behavior.

    Returns Promise<void>

    If the initial connection fails.

  • Closes the SSE event stream. REST methods remain usable. Will not trigger automatic reconnection.

    Returns void