← Back to Docs
开发文档

DejaOS Platform Developer Guide

Published 2026-08-26

EN

DejaOS is CoolCode酷豆’s IoT operating-system platform for smart access terminals (built on the LVGL graphics framework). This guide covers developer access paths, the Widget subprotocol and cloud open-API integration samples.

DejaOS is CoolCode酷豆’s IoT operating-system platform for smart access terminals, built on the LVGL graphics framework to unify device UI, interaction logic and rendering parameters; try it live at dejaos.coolcode.com.

1. Developer access paths

① Cloud open API: org sync, bulk permission push, access/alarm log return — for platform-level integration; ② device-side Widget: embeds AI/interaction into the terminal UI, handshaking securely with the terminal via a WebSocket subprotocol.

2. Cloud open API (org-sync sample)

Create an enterprise space on the CoolCode酷豆 cloud platform to get the API Key and device-group ID; then push personnel and permissions via the "org sync" API. The sample below is an honest skeleton — fields per the open API docs:

```js // Pseudocode: org-sync bulk push (fields per open API docs) const res = await fetch(`${PLATFORM_BASE}/api/v1/org/sync`, { method: "POST", headers: { "Authorization": `Bearer ${API_KEY}`, "Content-Type": "application/json" }, body: JSON.stringify({ groupId: DEVICE_GROUP_ID, users: [{ id, name, perm }] }) }); ```

3. Device-side Widget subprotocol (CoolCode.widget.v1)

The Widget handshakes with the terminal over WebSocket. The browser WebSocket API cannot set custom headers; the only channel to carry a credential at handshake is Sec-WebSocket-Protocol. The sample below shows negotiating CoolCode.widget.v1 — an honest skeleton:

```js // Pseudocode: handshake via subprotocol (token in subprotocol, not URL) const protocols = ["CoolCode.widget.v1", `kd-token.${btoa(urlSafe(TOKEN))}`]; const ws = new WebSocket("wss://dejaos.coolcode.com/widget", protocols); ws.onopen = () => console.log("subprotocol:", ws.protocol); // echoes CoolCode.widget.v1 ```

4. Integration notes

① Pass tokens via subprotocol, never in the URL (avoids access-log leakage); ② exact fields and token issuance follow the latest open-platform / product-manual docs; ③ debug end-to-end in a test space before switching to production.

FAQ

What is DejaOS?

CoolCode酷豆’s IoT operating-system platform for smart access terminals, built on the LVGL graphics framework to unify device UI, interaction logic and rendering parameters.

What access paths exist for developers?

Two: ① cloud open API (org sync, permission push, log return); ② device-side Widget interacting with the terminal via the WebSocket subprotocol CoolCode.widget.v1.

How does the Widget subprotocol authenticate?

At handshake, the subprotocol token CoolCode.widget.v1 plus credential travel via Sec-WebSocket-Protocol; the exact token is the Widget Token issued by the open platform — pass it via subprotocol, not in the URL.

← Back to Home
免费获取方案白皮书48 小时内响应 · 写入 CRM 线索池
立即咨询