How the SDK works
The two halves of the SDK, its two modes, what you decide and why the browser carries no token.
Preview 0.45 Available · Preview 0.45. The API can change before 1.0: see Release phases.
The SDK runs the capture for you: the protocol, the steps, the batches, the baseline and the results of the session. You build the screens and decide what each step means.
Two halves
Section titled “Two halves”The SDK is two npm packages, one per side of the wire:
- In the browser,
@neurologyca/capture: the live client (createProtocolClient) and, from@neurologyca/capture/record, the recording client (createRecordingClient). - In your backend,
@neurologyca/capture-server: the proxy that adds the token (createEngineProxy),createEngineAdminfor people, enrolments and results, and, for deferred, the upload receiver (createUploadReceiver).
- Browser@neurologyca/capture
- Your backend@neurologyca/capture-server: proxy + token + admin + receiver
- Engine
Two modes
Section titled “Two modes”- On-device (real time): processed in the browser as you capture; for short captures, results arrive during the session and seconds after the last batch, while long captures take minutes to close. Video and audio never leave the device; landmarks and expression data go to Engine, plus the transcript and extra signals only if you turn them on. Limited by the device: the face detection on the GPU (WebGL 2) and, on phones, heat in long sessions.
- Deferred (server-side): the SDK records the video and a step manifest and uploads them; our processing service handles them shortly after. It is not hours later: it just doesn’t run on the device. Today you can record, upload and process with Neurologyca’s processing service: nothing to deploy.
Which one, and how to combine the SDK with the HTTP API: Integration paths.
No token in the browser
Section titled “No token in the browser”Your page talks to your backend, and your backend’s proxy adds the token. Create the client with your proxy’s path and no getToken:
import { createProtocolClient } from '@neurologyca/capture'
const client = createProtocolClient({ baseUrl: '/engine', taxonomy }) // your proxy: no key, no token in the pageWhat you decide
Section titled “What you decide”The screens and their texts; consent before captureProtocol, and only from a gesture of the person; who closes each step and what a step without text says; who your users are and which ids each one can touch (authorize with ownsAll). The SDK and capture-server do the Engine routes, the token, the batches, the retries and the reservation. The full table is in Integration paths.
The pages of this group
Section titled “The pages of this group”- On-device (real time): the live client, step by step.
- Deferred (server-side): recording and uploading.
- Steps and marking: who closes a step, the clock and the manifest.
- Results in your backend: reading results later, SSE or polling, and the webhook.
- Your backend: the proxy,
createEngineAdminand the receiver. - Processing service: what our service does and what you expose.
- Errors, warnings and retries: every code, by layer, and support.
- SDK reference: every export, with its signature.