Documentation
¶
Overview ¶
Package main implements adapter-mfc: a microservice that adapts MyFreeCams' FCS WebSocket protocol to a simple HTTP/JSON interface, maintaining a live online-models list and serving the snapshot over HTTP.
On connect the service ingests the bulk MANAGELIST/CAMS dump as the initial snapshot, then applies SESSIONSTATE updates as MFC pushes them. On disconnect it reconnects with exponential backoff.
HTTP routes:
- GET /online — current snapshot as OnlineListResults JSON. Always 200; when no bulk has been applied yet, the body has failed=true so the caller distinguishes daemon-level failure from transport failure (5xx).
- GET /status?name=<name> — backs the bot's QueryStatus for MFC. Returns a cmdlib.StreamerInfoWithStatus JSON document; only the status field is populated for MFC. See handleStatus.
- GET /healthz — liveness probe; always 200 "ok" while the process is responsive. Readiness is signalled by /online's failed flag.
- GET /version — the build's cmdlib.Version string.
Log convention: @-prefixed keys (@nm, @vs, @uid) are raw protocol fields; bare keys are values resolved from local state.
In-memory online-models state for adapter-mfc, plus the methods that mutate and read it. The snapshot is updated by the websocket reader and served by the HTTP handlers.
FCS websocket wire format: parses raw frame bytes into typed application messages and builds outbound frames for the requests we send. The dispatcher in main.go does a type switch on the parsed result.