API reference
Watch a terminal
- SSE
- GET https://api.inorbit.hr/v1/coordinator/terminals/{handle}/eventsAccept: text/event-stream; one data: line of JSON per event
- WebSocket
- wss://api.inorbit.hr/v1/ws{"type":"call","id":"1","method":"iohr.coordinator.v1.CoordinatorService/WatchTerminal","body":{…}}
- MQTT 5
- wss://api.inorbit.hr/v1/mqttsubscribe to coordinator/terminals/{handle}/events
One shared terminal as server-sent events: its session, then each sealed frame the Mac addressed to your phone's peer label from the moment you connect (the relay keeps nothing for a phone that is not watching), as ciphertext only. Another phone's frames never reach you, and a frame with no peer reaches nobody. Every frame addressed to you arrives, in order, none skipped or merged by the server (frames are at most 64 KiB; the Mac batches its own output). A watcher that falls behind its bounded queue is ended with closed reason lagged and reconnects. The stream also ends with closed when the Mac goes quiet for a heartbeat (15 s), and never outlives the token or 15 minutes. Only your own person token is served. The handle may also be hs or hb, the link's own frames, which belong to no session and need only the Mac to be serving.
Needs scope terminals:read.
bearerAuthorizationBearer <JWT>An access token from the identity provider: a person's, or a customer's from the client credentials grant with an API key (developers.inorbit.hr). The gateway verifies it; the audience is iohr-api.
handle*stringThe session's handle, from List terminals, or hs or hb; it is part of the path.
peer*stringYour phone's own label, the one you send under (required, 1 to 64 letters, digits, - and _); routing only. Without a valid one the call is refused as 400.
A stream of iohr.coordinator.v1.WatchTerminalResponse events, one JSON object per data:; a failure is an error event carrying Problem
text/event-stream- response
iohr.coordinator.v1.WatchTerminalResponse
closed?iohr.coordinator.v1.TerminalsClosed
heartbeat?iohr.coordinator.v1.TerminalsBeat
session?iohr.coordinator.v1.TerminalSession
terminal_frame?iohr.coordinator.v1.TerminalFrame
import { ApiError, Public } from "@inorbithr/sdk";// Reads INORBIT_TOKEN, or INORBIT_KEY_ID and INORBIT_KEY_SECRET.const api = Public.fromEnv();try { for await (const event of api.coordinator.watchTerminal("<handle>", { peer: "<peer>" })) { console.log(event); }} catch (e) { if (!(e instanceof ApiError)) throw e; console.error(`${e.code}: ${e.problem} (request id ${e.raw.requestId})`); process.exitCode = 1;}npm install @inorbithr/sdk. Calls the package's public surface; an operation newer than your package needs the next release or a client generated for your account. The SDKs.
{ "closed": { "reason": "string" }, "heartbeat": {}, "session": { "handle": "string", "input_enabled": true, "last_frame_at": "string", "sealed_meta": "string" }, "terminal_frame": { "handle": "string", "peer": "string", "sealed": "string", "seq": "string" }}