Skip to content

Connectivity ​

SDK Open uses two WebSocket channels:

  • Command WS carries all JSON command requests and responses.
  • Video WS only carries video output and stream-related events.

Business tokens are not passed in WebSocket handshake URLs. The client first connects Command WS anonymously, then binds a session by calling auth.create_session.

Connection Endpoints ​

ChannelDefault external SDK connectionPlaintext compatibility endpointPurpose
Assethttps://sdk-runtime.localhost:18082http://127.0.0.1:17082Upload input files and read task assets.
Command WSwss://sdk-runtime.localhost:18090ws://127.0.0.1:17090Send JSON requests and receive responses and events.
Video WSwss://sdk-runtime.localhost:18091ws://127.0.0.1:17091Receive video output and stream events.

The external SDK package enables TLS by default and maps sdk-runtime.localhost to 127.0.0.1. Clients should use the HTTPS/WSS endpoints in the table. Plaintext HTTP/WS endpoints are for explicitly configured compatibility scenarios only and are not recommended for new integrations; an HTTPS page cannot connect to plaintext ws.

Video WS must retain the session_token and stream_id query parameters with either ws or wss. Command WS still does not put API keys, session tokens, or business parameters in its handshake URL.

TLS Configuration ​

The default external SDK configuration already enables SDK_TLS_ENABLED=1. To explicitly enable or adjust TLS in a custom deployment, provide a complete certificate chain and its matching private key:

SettingDescription
SDK_TLS_BIND_HOSTTLS listener address; defaults to the runtime bind_host.
SDK_TLS_CERT_FILEPEM/fullchain file containing the server certificate and intermediate certificates.
SDK_TLS_KEY_FILEServer PEM private-key file.
SDK_TLS_KEY_PASSWORDOptional private-key password.
SDK_ASSET_HTTPS_PORTAsset HTTPS port, default 18082.
SDK_COMMAND_WSS_PORTCommand WSS port, default 18090.
SDK_VIDEO_WSS_PORTVideo WSS port, default 18091.
SDK_ASSET_BASE_URLSet to the client-reachable HTTPS asset base URL for remote, NAT, or DNS deployments.

The official package configures a local certificate and trusted root CA for sdk-runtime.localhost. Clients that use an independent certificate store must still import the applicable CA. TLS protects the transport only; it does not replace API keys, the auth.create_session session authentication, asset authorization, or network access controls. Admin and the local demo continue to use their existing HTTP ports.

1. Check the Runtime ​

If Admin HTTP is enabled, check runtime health first:

bash
curl http://127.0.0.1:17080/healthz

The admin status endpoint requires an admin token:

bash
curl -H "Authorization: Bearer <admin-token>" http://127.0.0.1:17080/api/status

2. Connect Command WS ​

With the default external SDK WSS connection:

text
wss://sdk-runtime.localhost:18090

After the connection is open, send system.ping:

json
{
  "request_id": "req-ping-001",
  "method": "system.ping",
  "params": {},
  "client": {
    "source": "your-app",
    "protocol_version": "2.0.0",
    "trace_id": "trc-001"
  }
}

Successful response:

json
{
  "request_id": "req-ping-001",
  "code": 0,
  "message": "ok",
  "data": {
    "pong": true
  },
  "ts": 1710000000
}

3. Query Public Capabilities ​

Use system.capabilities to check exposed methods and the auth model:

json
{
  "request_id": "req-cap-001",
  "method": "system.capabilities",
  "params": {}
}

The returned methods include public methods such as auth.create_session, device.list, device.open, device.close, video.start, and video.stop.

4. Connect Video WS ​

Video WS cannot be connected anonymously. Call video.start first to get session_token and stream_id, then use the default WSS connection:

text
wss://sdk-runtime.localhost:18091?session_token=<session-token>&stream_id=<stream-id>

For a custom TLS hostname, replace the host with one in the server certificate:

text
wss://<tls-host>:18091?session_token=<session-token>&stream_id=<stream-id>

After the connection is accepted, the server sends a video.ready text event. Each frame then consists of:

  • one stream.frame_meta text event
  • one MJPEG/JPEG binary frame

Clients should decode binary frames as JPEG/MJPEG images according to stream.frame_meta.pixel_format=mjpeg, then draw the decoded image to Canvas. Render with a latest-frame-wins strategy to avoid latency when decoding or drawing is slower than the input frame rate.

CZUR Open Platform Documentation