Helios

HTTP adapter

Mount unbound REST and viewer WebSocket routes in a host Elysia app.

createSacnHttpAdapter returns an Elysia plugin. It does not listen on a port, configure CORS, rate-limit, or choose an auth policy. Your host app owns deployment.

npm install @helioslx/core elysia @elysiajs/node @elysiajs/openapi
import { createSacnSource } from "@helioslx/core/node";
import { createSacnHttpAdapter } from "@helioslx/core/http";
import { Elysia } from "elysia";

const source = createSacnSource({
  name: "HTTP control",
  transportOptions: { iface: "192.168.10.20" },
  installProcessHandlers: false,
});

await source.start();

const sacn = createSacnHttpAdapter({
  source,
  prefix: "/sacn",
  auth: ({ request }) => {
    // Return false for 401, or a Response to forward.
    return request.headers.get("authorization") === `Bearer ${process.env.TOKEN}`;
  },
});

const app = new Elysia().use(sacn);
app.listen({ hostname: "127.0.0.1", port: 3000 });

Options

OptionDefaultPurpose
sourcerequiredSource to control
viewerEnables viewer routes and /viewer/ws
prefix/sacnRoute prefix
authHook per request
openapiPath/openapiOpenAPI document path
maxWebSocketClients64Concurrent viewer sockets
webSocketQueueCapacity32Coalesced queue per socket

Canonical routes

All paths are under prefix (default /sacn).

MethodPathAction
GET/health/liveLiveness
GET/health/readyReady when source is running
GET/universesList active outputs
GET/engine/telemetryEngine telemetry
GET/universes/:u/priorities/:pGet one output
PUT/universes/:u/priorities/:pUpsert full frame
POST/universes/:u/priorities/:p/channelsSparse channel writes
POST/universes/:u/priorities/:p/frameWrite full frame
DELETE/universes/:u/priorities/:pClear output

Channel bodies accept a map or an array of writes, with optional shared or per-channel durationMs. Frame bodies use durationMs for a shared fade.

When a viewer is provided:

MethodPathAction
GET/PUT/DELETE/viewer/universesSelection
POST/DELETE/viewer/universes/:universeAdd / remove
GET/viewer/telemetryViewer telemetry
WS/viewer/wsServer → client packet stream

Deprecated /outputs… aliases still exist with deprecation headers. Prefer the /universes/…/priorities/… paths.

Host responsibilities

  • Bind address (prefer 127.0.0.1 unless auth and network are locked down)
  • TLS or reverse proxy
  • CORS (avoid wildcards on live control)
  • Rate and body-size limits
  • Process signals and shutdown order when not using Node auto-handlers

The adapter owns neither the source nor the viewer. Stop the HTTP server, then close() services you own.

See the embedded HTTP example.

On this page