Server API
import { Server } from 'iosignal';
const server = new Server({ port: 7777 });
// When the application shuts down:
// server.close(() => console.log('Server closed'));
Provide at least one transport option: port, httpServer, or congPort. port opens WebSocket; httpServer attaches to an existing HTTP server, with wsPath selecting the upgrade path; congPort serves the Arduino TCP transport.
| Option | Meaning |
|---|---|
timeout, monitorPeriod | Milliseconds; constructor values must be at least 1000 |
showMessage, showMetric | Message and metric logging |
membersOnly | Require authentication; configure an authentication provider |
pingTimeoutGrace | Finite, nonnegative heartbeat grace |
security.maxClockSkewMs | Positive safe integer clock-skew limit |
security.authChallengeMaxAgeMs | Positive safe integer challenge lifetime |
security.maxReplayEntries | Positive safe integer replay-cache capacity |
Consult the installed 7.2.0 serverOption defaults before overriding limits. close(callback) closes the server and calls the callback after shutdown. For authenticated deployments, pass a BohoAuth instance as the second constructor argument; see authentication.
Services
server.attach(name, service) registers an application service. A service exposes its allowed commands and may implement checkPermission(remote, req). Dispatch uses named command methods or the service's call(remote, req) entry point. Return responses through the installed implementation's replyService mechanism; inspect its types and service tests for the request/response contract.
Service authorization is an application responsibility. A generic IOSignal server does not automatically provide Remocon account-management APIs. See create a server for the runnable transport example.